Results 1 to 6 of 6

Thread: [2008] Code Issue

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    17

    [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

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] Code Issue

    You want to know the code to make the combobox work? Work in what way?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    17

    Re: [2008] Code Issue

    It is to show the progress of a page loading up.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2008] Code Issue

    How is a ComboBox supposed to show page loading progress?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2008
    Posts
    17

    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.

  6. #6
    Lively Member Divine's Avatar
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    68

    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
  •  



Click Here to Expand Forum to Full Width