Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

adding a loop!

hello
how can I add a loop to this so it keeps going to different sites

    Private Sub cmdMail_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdMail.Click
        On Error Resume Next
        Dim i As Integer
        Dim txtOne, txtTwo As Object

            Call WebBrowser1.Navigate(New System.Uri("http://www.email.com"))

            While (WebBrowser1.ReadyState <> System.Windows.Forms.WebBrowserReadyState.Complete)
                System.Windows.Forms.Application.DoEvents()
            End While

            With WebBrowser1.Document.DomDocument
                txtOne = .GetElementsByName("email")(0)
                txtTwo = .GetElementsByName("pass")(0)

                txtOne.Value = "email@isp.com"
                txtTwo.Value = "pass"

                .Forms(1).submit()
            End With

            While (WebBrowser1.ReadyState <> System.Windows.Forms.WebBrowserReadyState.Complete)
                System.Windows.Forms.Application.DoEvents()
            End While

    End Sub
0
aplelois
Asked:
aplelois
  • 4
  • 2
1 Solution
 
mydasxCommented:
create a list of website urls (import from file or hard code it) then simply do a for loop and iterate through the list and slam text into your navigate call
0
 
apleloisAuthor Commented:
how will that be ?
0
 
mydasxCommented:
lets say we hard code it...

dim listOfUrls as ArrayList = new ArrayList()
listOfUrls.Add("http://www.google.com")
listOfUrls.Add("http://www.yahoo.com")
listOfUrls.Add("http://www.msn.com")
'etc etc keep adding them into the list as so

'then inside your code post this

For Each urlPath as String in listOfUrls
     Call WebBrowser1.Navigate(New System.Uri(urlPath))
Next
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
apleloisAuthor Commented:
oh yes I get you but the prob is that not all the sites have

                txtOne = .GetElementsByName("email")(0)
                txtTwo = .GetElementsByName("pass")(0)

some of them have username or passwd or u_pass etc... so I have
to declare that for each url!!
0
 
mydasxCommented:
my answer seems to work for the question.  Post the points homey.
0
 
mydasxCommented:
thanx cetus
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now