Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a vb programe to call web page

Status
Not open for further replies.

AFK1

IS-IT--Management
Aug 26, 2005
38
US
I am trying to write a program that can acutally go to a web page and get the reultset for me. Here is how my programme should be.
Lets say that I have a part# and I need to add that to my database.
I need to check if a part is valid or not. For this when I enter the part number in the textbox and click on the Validate, I want to go to a specific web site. On web site there is a textbox, I want to send the text in my form text box to the site and with out clicking enter(usually when you go to web site and you enter something in that text box,you have to enter to get results) I want to automatically go to the result page and bring back the results in my grid on my form.

I have not worked on this kind of application. This is my first one and I need your help please.
 
Look where the form posts to, is there an id in the URL once you click submit
If so use that with your ID appended and parse the HTML

“I sense many useless updates in you... Useless updates lead to defragmentation... Defragmentation leads to downtime...Downtime leads to suffering..Defragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
The thing is that I don't know how to send the text in my text box to the web site and then do the query. Is there any sample code avaliabel?Any web site?

Thanks
 
Add an AxBrowser control. To send the text from the form's textbox to the site:
AxBrowser1.Document.getElementByID("textbox'sID").Value=textbox1.text

To click the button:
AxBrowser1.Document.getElementByID("buttonID").click()

**NOTES
textbox'sID: You get it by the page's source code, like <input type=text ... ID="something" ...>
The same for the button
 
If the form fields do not have id's, but names instead (which most older forms and many current ones do) you would use the forms and elements collections instead of getElementById:

[tt]AxBrowser.document.forms("formname").elements("controlname").value ...
[/tt]

Don't use capitalization incorrectly (note that document and value are NOT capitalized, and only the I in ID is). It might not matter to VB, but it does to the DOM, so it's better to do it right.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top