Vraag & Antwoord

Programmeren

HTML in VB

3 antwoorden
  • Ik ben pas nieuw met Visual Basic, maar graag zou ik in een Standard EXE project in een frame een webpagina willen hebben. Hoe kan ik deze webpagina in het frame krijgen? Mijn idee is: klik: Play button -> toon webpagina in frame
  • De code: [code:1:5f5fc1332d]Public Partial Class MainForm Public Sub New() Me.InitializeComponent() End Sub Sub WebBrowser1DocumentCompleted(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs) End Sub Sub Button1Click(ByVal sender As Object, ByVal e As EventArgs) Try webBrowser1.Url = New System.Uri(textBox1.Text, System.UriKind.Absolute) textBox1.Visible = False button1.Visible = False webBrowser1.Visible = True Me.FormBorderStyle = FormBorderStyle.Sizable Catch exc as UriFormatException MessageBox.Show("ERROR: Not a supported url!", "ERROR") End Try End Sub End Class Partial Class MainForm Inherits System.Windows.Forms.Form Private components As System.ComponentModel.IContainer Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If components IsNot Nothing Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Private Sub InitializeComponent() Me.webBrowser1 = New System.Windows.Forms.WebBrowser Me.button1 = New System.Windows.Forms.Button Me.textBox1 = New System.Windows.Forms.TextBox Me.SuspendLayout Me.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill Me.webBrowser1.Location = New System.Drawing.Point(0, 0) Me.webBrowser1.MinimumSize = New System.Drawing.Size(20, 20) Me.webBrowser1.Name = "webBrowser1" Me.webBrowser1.Size = New System.Drawing.Size(243, 67) Me.webBrowser1.TabIndex = 0 Me.webBrowser1.Visible = false AddHandler Me.webBrowser1.DocumentCompleted, AddressOf Me.WebBrowser1DocumentCompleted Me.button1.Location = New System.Drawing.Point(12, 38) Me.button1.Name = "button1" Me.button1.Size = New System.Drawing.Size(219, 23) Me.button1.TabIndex = 1 Me.button1.Text = "Go" Me.button1.UseVisualStyleBackColor = true AddHandler Me.button1.Click, AddressOf Me.Button1Click Me.textBox1.Location = New System.Drawing.Point(12, 12) Me.textBox1.Name = "textBox1" Me.textBox1.Size = New System.Drawing.Size(219, 20) Me.textBox1.TabIndex = 2 Me.textBox1.Text = "http://" Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(243, 67) Me.FormBorderStyle = FormBorderStyle.FixedSingle Me.Controls.Add(Me.textBox1) Me.Controls.Add(Me.button1) Me.Controls.Add(Me.webBrowser1) Me.Name = "MainForm" Me.Text = "Webview" Me.ResumeLayout(false) Me.PerformLayout End Sub Private textBox1 As System.Windows.Forms.TextBox Private button1 As System.Windows.Forms.Button Private webBrowser1 As System.Windows.Forms.WebBrowser End Class[/code:1:5f5fc1332d] Aan de fouten moet gewerkt worden :oops: maar de rest klopt redelijk!
  • Bedankt!

Beantwoord deze vraag

Weet jij het antwoord op deze vraag? Registreer of meld je aan met je account

Dit is een gearchiveerde pagina. Antwoorden is niet meer mogelijk.