
Ví dụ cụ thể như mình muốn làm 1 Form chính, khi bấm 1 button trên Form sẽ hiển thị nhiều 4 form, mỗi form sẽ hiển thị Webbrowser navigate 1 url khác nhau.
Điều hành viên: tungblt, vuathongtin
Mã: Chọn hết
Dim tenformbr as new webbrowser
Dim tenform as new form
'Phan nay bo vao Sub
With Me.tenform
.MaximizeBox = False
.MinimizeBox = False
.BackColor = White
.ForeColor = Black
.Size = New System.Drawing.Size(155, 265)
.Text = "Run-time Controls"
.FormBorderStyle = FormBorderStyle.FixedDialog
.StartPosition = FormStartPosition.CenterScreen
End With
With Me.tenformbr
.Navigate("http://google.com.vn")
End With
Mã: Chọn hết
'This creates a new tab
Dim tp As New TabPage
TabControl1.Controls.Add(tp)
'This creates a new webbrowser with the NewWindow Event
'And navigates it to the link wanting to be opened
Dim wb As New WebBrowser
Dim myElement As HtmlElement = WebBrowser1.Document.ActiveElement
Dim target As String = myElement.GetAttribute("href")
With wb
.Navigate(target)
.Dock = DockStyle.Fill
End With
AddHandler wb.NewWindow, AddressOf WebBrowser_NewWindow
tp.Controls.Add(wb)
'This prevents ie from popping up
e.Cancel = True
Quay về “Visual Basic .NET và C# (VB.NET & C#)”
Đang xem chuyên mục này: Không có thành viên nào trực tuyến. và 8 khách