Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 26th, 2004, 12:21 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fill out a web form

How would I use VB to find the names of fields on a web form and then fill out the form? For example going to the Juno page finding the password field and filling it out with a password stored in the VB program. Any reply would be really nice:)

 
Old February 26th, 2004, 12:26 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Where is the web form? Is your VB program running on the webserver or are you running on your machine?
 
Old February 26th, 2004, 12:33 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The VB program would run from my machine, nothing to do with the webserver.
Something that the Program "Gator" would do.
 
Old February 26th, 2004, 12:59 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you creating the web form is it a form you have no control over?
 
Old February 26th, 2004, 01:49 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

it's a web form that I have no control over. For example, Juno's Login Page.

 
Old February 26th, 2004, 02:13 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, short of doing an elaborate set of mouse clicks and keyboard inserts, I don't know of any way of doing this.
 
Old February 26th, 2004, 03:35 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I can fill out the information using "sendkeys". All I really need is a way of getting the cursor in the proper field.

 
Old February 26th, 2004, 05:29 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You could send enough tabs to get it into the field or use a mouse click Win API. The only way I can think of to find the right field would be to dowload the HTML and parse the page. I don't think I need to say that there is a relatively large margin of error in this type of coding. I would definitely look into trying to contact the vendor and see if there is an integration point to work with.
 
Old February 27th, 2004, 07:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I would use VB's WebBrowser control for this (you need to add "Microsoft Internet Controls" to your project for this). Drop one on a form, use the Navigate method to open the page you want, then WebBrowserName.document will give the DOM for that page and you can use standard DHTML syntax, like this:
With WebBrowserName.document
    .formname.fieldname.value = "whatever you want"
    .formname.submit()
End With

Note: make sure the page has loaded completely before trying to update the fields - there's an event for this, DownloadComplete or NavigateComplete - I forget which one...

hth
Phil
 
Old February 27th, 2004, 01:49 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That is great. It totally works. Thanks so much.






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to fill the IE's web page forms from VB? JohnThomas VB How-To 1 April 19th, 2009 06:53 AM
Fill datasheet/Continuous form with vba code only Galateo Access VBA 0 May 9th, 2008 09:39 AM
set Focus to web control in Web form vivekshah C# 1 June 17th, 2006 03:25 AM
Access form to web form clott BOOK: Access 2003 VBA Programmer's Reference 0 February 13th, 2006 06:44 PM
auto-fill form crmpicco HTML Code Clinic 2 April 21st, 2005 06:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.