Salve,
vorrei sapere come aprire in vb.net una pagina html cioè dovrei fare una mini finestra nel form, praticamente un riquadro in cui apro la pagina che voglio come si può ?
Grazie.
Salve,
vorrei sapere come aprire in vb.net una pagina html cioè dovrei fare una mini finestra nel form, praticamente un riquadro in cui apro la pagina che voglio come si può ?
Grazie.
devi usare il controllo webbrowser ti consiglio di cercare documentazione in msde.
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents AxWebBrowser1 As AxSHDocVw.AxWebBrowser
Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar
Friend WithEvents ToolBarButton1 As System.Windows.Forms.ToolBarButton
Friend WithEvents ToolBarButton2 As System.Windows.Forms.ToolBarButton
Friend WithEvents ToolBarButton3 As System.Windows.Forms.ToolBarButton
Friend WithEvents ToolBarButton4 As System.Windows.Forms.ToolBarButton
Friend WithEvents ToolBarButton5 As System.Windows.Forms.ToolBarButton
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
Me.AxWebBrowser1 = New AxSHDocVw.AxWebBrowser()
Me.ToolBar1 = New System.Windows.Forms.ToolBar()
Me.ToolBarButton1 = New System.Windows.Forms.ToolBarButton()
Me.ToolBarButton2 = New System.Windows.Forms.ToolBarButton()
Me.ToolBarButton3 = New System.Windows.Forms.ToolBarButton()
Me.ToolBarButton4 = New System.Windows.Forms.ToolBarButton()
Me.ToolBarButton5 = New System.Windows.Forms.ToolBarButton()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Button1 = New System.Windows.Forms.Button()
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).BeginIni t()
Me.SuspendLayout()
'
'AxWebBrowser1
'
Me.AxWebBrowser1.Enabled = True
Me.AxWebBrowser1.Location = New System.Drawing.Point(8, 96)
Me.AxWebBrowser1.OcxState = CType(resources.GetObject("AxWebBrowser1.OcxState" ), System.Windows.Forms.AxHost.State)
Me.AxWebBrowser1.Size = New System.Drawing.Size(656, 288)
Me.AxWebBrowser1.TabIndex = 0
'
'ToolBar1
'
Me.ToolBar1.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.ToolBarButton1, Me.ToolBarButton2, Me.ToolBarButton3, Me.ToolBarButton4, Me.ToolBarButton5})
Me.ToolBar1.DropDownArrows = True
Me.ToolBar1.Name = "ToolBar1"
Me.ToolBar1.ShowToolTips = True
Me.ToolBar1.Size = New System.Drawing.Size(672, 39)
Me.ToolBar1.TabIndex = 1
'
'ToolBarButton1
'
Me.ToolBarButton1.Text = "Pagina Iniziale"
'
'ToolBarButton2
'
Me.ToolBarButton2.Text = "Aggiorna"
'
'ToolBarButton3
'
Me.ToolBarButton3.Text = "Precedente"
'
'ToolBarButton4
'
Me.ToolBarButton4.Text = "Successiva"
'
'ToolBarButton5
'
Me.ToolBarButton5.Text = "Stop"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(16, 56)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(456, 20)
Me.TextBox1.TabIndex = 2
Me.TextBox1.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(496, 56)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 24)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Vai a URL"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(672, 397)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.TextBox1, Me.ToolBar1, Me.AxWebBrowser1})
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.AxWebBrowser1, System.ComponentModel.ISupportInitialize).EndInit( )
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyUrl As String
MyUrl = TextBox1.Text
Cursor.Current = Cursors.WaitCursor
AxWebBrowser1.Navigate(MyUrl, "", "", "", "")
Cursor.Current = Cursors.Default
End Sub
Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
If (e.Button Is ToolBarButton1) Then
AxWebBrowser1.GoHome()
End If
If (e.Button Is ToolBarButton2) Then
AxWebBrowser1.Refresh()
End If
If (e.Button Is ToolBarButton3) Then
AxWebBrowser1.GoBack()
End If
If (e.Button Is ToolBarButton4) Then
AxWebBrowser1.GoForward()
End If
If (e.Button Is ToolBarButton5) Then
AxWebBrowser1.Stop()
End If
End Sub
End Class