listbox1 nagivate to url

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • XxMaSterXx
    New Member
    • Feb 2007
    • 6

    listbox1 nagivate to url

    My program Extracts certain urls to a Listbox

    Example listbox1 urls
    http://www.thescripts. com/forum/newthread.php?d o=newthread&f=1 32
    http://www.thescripts. com/forum/newthread.php?d o=newthread&f=1 31
    http://www.thescripts. com/forum/newthread.php?d o=newthread&f=1 30
    http://www.thescripts. com/forum/newthread.php?d o=newthread&f=1 35

    I would like to be able to click the url in the linkbox and it will load on the actuall program, using web broswer controls

    Can anyone help me>?

    Thanks
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Hi. Do you have a web browser control on your form?

    Comment

    • XxMaSterXx
      New Member
      • Feb 2007
      • 6

      #3
      yes im using it

      i used this code

      Code:
      If List1.ListIndex <> -1 Then
              MousePointer = 11  ' sets the cursor to an hourglass
              WebBrowser1.navigate (List1.Text)
              MousePointer = 0   ' sets the cursor back to the default arrow
          Else
              MsgBox "Click on a web site in the list first."
          End If
      But u have to click the url inthe listbox and press a command button to go to that url

      Is there anyway to make it automatically go down the list and connect to the first one url then sec, then third..So on..(inorder) inside listbox?
      Last edited by willakawill; Feb 22 '07, 07:26 PM. Reason: please use code tags when posting code

      Comment

      • willakawill
        Top Contributor
        • Oct 2006
        • 1646

        #4
        Your listbox has a click event. double click on the listbox in design view and the code will write itself. When the listbox has the focus and you navigate using the up / down arrows this will fire the click event and you can test the output like this:

        Code:
        Private Sub List1_Click()
           MsgBox Me.List1.Text
        End Sub

        Comment

        • XxMaSterXx
          New Member
          • Feb 2007
          • 6

          #5
          I tired that, It just opens a msg box after i click the url in the list box..

          I Just want to Click a Command button, and it will Automatically open the first Url in the list box.. fill in a text field and submit a button

          Than it will automatically click the second url and ect...



          I really appreciate your help :)

          Comment

          • XxMaSterXx
            New Member
            • Feb 2007
            • 6

            #6
            I started a forum and as everyone probably knows, its good to have topics and users and not be blank


            So this program will help my forum take off(well i hope)

            Thanks again

            Comment

            • willakawill
              Top Contributor
              • Oct 2006
              • 1646

              #7
              It is supposed to open a msgbox as a test to show that the click event is working. It is then up to you to replace the msgbox code with your browser code
              Code:
              Private Sub List1_Click()
                 MsgBox Me.List1.Text
                 'replace the msgbox code above with code to
                 'pass the url (Me.List1.Text) to your browser
              End Sub

              Comment

              • XxMaSterXx
                New Member
                • Feb 2007
                • 6

                #8
                Sorry, but i still dont understand that

                can you give me an example

                Thanks soo much

                Comment

                • XxMaSterXx
                  New Member
                  • Feb 2007
                  • 6

                  #9
                  Nevermind i got it work..Thanks

                  Code:
                  Private Sub List1_Click()
                      WebBrowser1.navigate (Me.List1.Text)
                     'replace the msgbox code above with code to
                     'pass the url (Me.List1.Text) to your browser
                  End Sub

                  Code:
                  Private Sub Command3_Click()
                  
                  Dim HTML As HTMLDocument
                  
                  Dim INP As HTMLInputElement
                  
                  Set HTML = WebBrowser1.document
                  
                  For Each INP In HTML.getElementsByTagName("input")
                      If INP.Type = "button" Then
                  
                          'Check the ALT, NAME, SRC, ID, onlcick, etc
                  
                          'Look for Submit, Login, or whatever this button is doing
                  
                          If INP.alt = "Submit" Or INP.Name = "addcomment" Or INP.Value = "Submit" Then
                  
                              INP.Click
                          End If
                  
                      End If
                  Next
                  End Sub
                  this code clicks a button(as you prob already know)

                  So now , how can i make it so when i click the command button it submits and then goes to the next url on the list?

                  Comment

                  Working...