|
-
Feb 3rd, 2008, 03:30 PM
#1
Thread Starter
Junior Member
[2008] Code Issue
Hi all. I am creating a web browser as we know. I have decided to go form a textbox for the URL input to a combobox but the code change was not as simple as it seemed. So here is my entire coding for the browser. It has the text box1 in it and I would like to know what codeing is needed for the combobox to work. Thanks.
Code:
Public Class Form1
'Code for Go button
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate(TextBox1.Text)
)
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
'Code for back button
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
WebBrowser1.GoBack()
End Sub
'Command for stop button
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
WebBrowser1.Stop()
End Sub
'Command for forward buttom
Private Sub forward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles forward.Click
WebBrowser1.GoForward()
End Sub
'Code for home button
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.GoHome()
End Sub
'Code for browser screen
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
End Sub
'Code for refresh button
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
WebBrowser1.Refresh()
End Sub
Last edited by colsie; Feb 3rd, 2008 at 03:32 PM.
Reason: title stated cod
-
Feb 3rd, 2008, 04:15 PM
#2
Re: [2008] Code Issue
You want to know the code to make the combobox work? Work in what way?
-
Feb 3rd, 2008, 04:51 PM
#3
Thread Starter
Junior Member
Re: [2008] Code Issue
It is to show the progress of a page loading up.
-
Feb 3rd, 2008, 06:05 PM
#4
Re: [2008] Code Issue
How is a ComboBox supposed to show page loading progress?
-
Feb 4th, 2008, 02:35 PM
#5
Thread Starter
Junior Member
Re: [2008] Code Issue
Sorry meant to say for the combobox to be the URL bit to type so a history can be stored. If I do that though I would need to know how to add a button to delete the history.
-
Feb 4th, 2008, 07:59 PM
#6
Lively Member
Re: [2008] Code Issue
Use My.Settings.
Locate to View > Property Pages > Settings Tab
Change the name to "History" and change the type to System.Collections.Specialized.StringCollection. (Opening the types drop-down menu might take a while to load).
This code just adds www.google.com. But I think you get the general idea.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Settings.History Is Nothing Then
My.Settings.History = New Specialized.StringCollection
My.Settings.History.Add("www.google.com" & "," & "Google Search Engine")
My.Settings.Save()
End If
For Each History As String In My.Settings.History
Dim strArray() As String = History.Split(",")
ComboBox1.Items.Add(strArray(1))
Next
End Sub
To remove the history, just make a button with a click event with the code:
Code:
ComboBox1.Items.Clear()
I hope it helps! =)
Last edited by Divine; Feb 4th, 2008 at 08:02 PM.
"He who asks a question is a fool for five minutes; he who does not ask a question remains a fool forever."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|