inte the options for the homepage button i typed in
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(Form2.TextBox1.Text)
and i know that itīs working. and sure.. i can change the homepage in the options menu but when i cloas the options menu my homepage goes to "blank". here is my code for the form2.:
Public Class Form2 Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click My.Settings.Save() End Sub End Class
and here is my code for form1:
Public Class Form1
Dim i As Integer = 1
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
TabControl1.TabPages.RemoveAt(TabControl1.SelectedIndex)
TabControl1.SelectTab(TabControl1.TabPages.Count - 1)
i = i - 1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Stop()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Refresh()
End Sub
Private Sub WebBrowser1_DocumentCompleted1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
'your url text box will show the actual url of the page after the page is fully loaded
TextBox1.Text = e.Url.ToString
Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " - Pontus Browser"
TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(TextBox1.Text)
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
Dim web As New WebBrowser()
Dim tab As New TabPage("ja")
'do what you want to with the webbrowser'
'do what you want to with the tabpage'
tab.Controls.Add(web)
TabControl1.TabPages.Add(tab)
web.Dock = DockStyle.Fill
End Sub
Private Sub ToolStripStatusLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ToolStripProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripProgressBar1.Click
End Sub
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
My.Settings.Save()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myWebBrowser As New WebBrowser
TabControl1.SelectTab(1 - 1)
TabControl1.SelectedTab.Controls.Add(myWebBrowser)
i = i + 1
ToolStripMenuItem1.Text = "Favorites"
ToolStripMenuItem2.Text = "Add"
WebBrowser1.Navigate("http://www.lanslaget.se")
' Load Settings to Favorites menu when opening form
For Each item As String In My.Settings.favList
Dim item1 As New ToolStripMenuItem
item1.Text = item.ToString
ToolStripMenuItem1.DropDownItems.Add(item1)
Next
'Add Click Event handler for each Favorite link ToolStripMenuItem
For Each C As ToolStripMenuItem In ToolStripMenuItem1.DropDownItems
AddHandler C.Click, AddressOf ToolStripMenuItem_click
Next
End Sub
Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
Dim ProRender As New System.Windows.Forms.ToolStripProfessionalRenderer()
End Sub
Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs)
' Check if e.MaximumProgress is 0 or
' if e.MaximumProgress is less than e.CurrentProgress
If e.MaximumProgress <> 0 And _
e.MaximumProgress >= e.CurrentProgress Then
ToolStripProgressBar1.Value = Convert.ToInt32( _
100 * e.CurrentProgress / e.MaximumProgress)
End If
End Sub
Private Sub WebBrowser1_StatusTextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).StatusText
End Sub
Private Sub WebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
TextBox1.Text = e.Url.ToString
Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " - Pontus Browser"
TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle
i = i + 1
End Sub
Private Sub WebBrowser1_ProgressChanged1(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
' Check if e.MaximumProgress is 0 or
' if e.MaximumProgress is less than e.CurrentProgress
If e.MaximumProgress <> 0 And _
e.MaximumProgress >= e.CurrentProgress Then
ToolStripProgressBar1.Value = Convert.ToInt32( _
100 * e.CurrentProgress / e.MaximumProgress)
End If
End Sub
Private Sub WebBrowser1_StatusTextChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebBrowser1.StatusTextChanged
ToolStripStatusLabel1.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).StatusText
End Sub
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
SaveFileDialog1.ShowDialog()
End Sub
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
AboutBox1.Show()
End Sub
Private Sub ToolStripProgressBar1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles ToolStripProgressBar1.Paint
End Sub
Private Sub OptionsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles OptionsToolStripMenuItem.Click
Form2.Visible = True
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(Form2.TextBox1.Text)
Dim home As String
home = " "
End Sub
Private Sub ToolStripComboBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ToolStripSeparator6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripSeparator6.Click
End Sub
Private Sub AddFavoritesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddFavoritesToolStripMenuItem.Click
ToolStripComboBox1.Items.Add(CType(Me.TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Url.ToString)
My.Settings.Save()
End Sub
Private Sub PrintPreviewControl1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click
WebBrowser1.Navigate(sender.ToString)
End Sub
Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
Dim item1 As New ToolStripMenuItem
item1.Text = WebBrowser1.Url.ToString
ToolStripMenuItem1.DropDownItems.Add(item1)
My.Settings.favList.Add(WebBrowser1.Url.ToString)
End Sub
End Class
Public Class MyProfessionalColorTable
Inherits ProfessionalColorTable
End Class
I will also give you a print screen, here it come:
Attached image(s)
This post has been edited by EndLessMind: 15 March 2009 - 03:11 PM

New Topic/Question
Reply




MultiQuote


|