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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filling ASP fields from VB 1

Status
Not open for further replies.

KarMac21

Programmer
Jan 8, 2001
109
US
Hi all,

I have a simple question (I hope). Is it possible to fill fields on an asp page from VB?

For example:

There is a website I visit daily and want to be able to enter my ID and Password in my vb program and have that prefill the webpage with the same info.

If this possible?

Thanks for your help,
Shane
 
Yes this is possible, you should post this msg though in Visual Basic forum.

You'll need to use visual basic's webcontrol, then access the document from the webcontrol and input your userid and password programtically.

MrGreed

"did you just say Minkey?, yes that's what I said."
 
I can see how you would need to use the webcontrol for this, but still, how would you reference the document from your webcontrol?

Could you give us an example in code of how you would go about doing this?

dpdoug
 
Ok here yah go:

Create a new project in VB, add the component "Microsoft internet controls"

Place the web control on the form. Name the webcontrol wb1 . Add a button to the form, place in the buttons onclick event the following code:


wb1.Navigate "
Dim GWB As WebBrowser
Dim objUserID As Object
Dim objPassword As Object

Set GWB = wb1

Set objUserID = GWB.Document.getElementsByName("username")
Set objPassword = GWB.Document.getElementsByName("password")

objUserID.Item(1).Value = "myurerid"
objPassword.Item(1).Value = "mypassword"


You will need to find out what name they use on your specific website and change the getElementsByName above, also you'll need to check if the collection returned by getElementsByName which position in the collection your specific input falls but it works.

Change the navigate from the onclick button to inside the webcontrol itself or onload of the form.

And there you have it.

Enjoy!


MrGreed

"did you just say Minkey?, yes that's what I said."
 
Thank you very much MrGreed!!!!!!! That did the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top