J
James
Hello everyone,
I am trying to pull information off of a Bus Transit website. They do not
have web services and have know plans too!
I would like to know:
1. how to run/start a click event on an Input button
2. and also is it possible to trap the page being returned - currently
if I click the button manually it opens up a browser with the new page.
Below is the code I am using. I can update the info I need to, but cannot
fire the click event on the submit button. Also, getting the returning page
into WB1 would be needed also.
-JD
Here is the page I load into a WebBrowser control:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bntFetch.Click
wb1.Url = New
Uri("http://www.edmonton.ca/portal/server.pt?space=CommunityPage&control=SetCommunity&CommunityID=239")
End Sub
From there I can find all the info I need:
Private Sub btnParsePage_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnParsePage.Click
Dim htmlDoc As System.Windows.Forms.HtmlDocument = wb1.Document
Dim htmlDocColl As System.Windows.Forms.HtmlElementCollection =
htmlDoc.Forms("frmBusStopScheduleForm").All
For Each El As System.Windows.Forms.HtmlElement In htmlDocColl
If El.Name.Trim = "" Then
Else
'This is the bus stop I want info for
If El.Name.Trim = "txtBusStopNumber" Then
El.InnerText = "5551"
End If
'This is the button to click to get the bus stop info
If El.Name.Trim = "cmdBusStopScheduleSubmit" Then
'this does not work?!
El.InvokeMember("cmdBusStopScheduleSubmit.onclick")
End If
lstDocEles.Items.Add(El.Name.ToString)
End If
Next
End Sub
I am trying to pull information off of a Bus Transit website. They do not
have web services and have know plans too!
I would like to know:
1. how to run/start a click event on an Input button
2. and also is it possible to trap the page being returned - currently
if I click the button manually it opens up a browser with the new page.
Below is the code I am using. I can update the info I need to, but cannot
fire the click event on the submit button. Also, getting the returning page
into WB1 would be needed also.
-JD
Here is the page I load into a WebBrowser control:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bntFetch.Click
wb1.Url = New
Uri("http://www.edmonton.ca/portal/server.pt?space=CommunityPage&control=SetCommunity&CommunityID=239")
End Sub
From there I can find all the info I need:
Private Sub btnParsePage_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnParsePage.Click
Dim htmlDoc As System.Windows.Forms.HtmlDocument = wb1.Document
Dim htmlDocColl As System.Windows.Forms.HtmlElementCollection =
htmlDoc.Forms("frmBusStopScheduleForm").All
For Each El As System.Windows.Forms.HtmlElement In htmlDocColl
If El.Name.Trim = "" Then
Else
'This is the bus stop I want info for
If El.Name.Trim = "txtBusStopNumber" Then
El.InnerText = "5551"
End If
'This is the button to click to get the bus stop info
If El.Name.Trim = "cmdBusStopScheduleSubmit" Then
'this does not work?!
El.InvokeMember("cmdBusStopScheduleSubmit.onclick")
End If
lstDocEles.Items.Add(El.Name.ToString)
End If
Next
End Sub