|
-
Sep 11th, 2006, 08:28 AM
#1
Thread Starter
New Member
Auto Fill Web Control Form
Hi,
As part of my work i have to check a number of diffrent email accounts each day. I have set up a simple form using VB6 with a webbrowser control navigating to the website. I would like to not have to type in my username and password everyday. Is there anyway of auto filling these fields? The fields on the webpage are called 'user' and 'pass'. I am new to VB programming so something easy would be nice.
Many thanks for your help,
-
Sep 11th, 2006, 08:33 AM
#2
PowerPoster
Re: Auto Fill Web Control Form
Have a look at http://home.rochester.rr.com/lgsstatic/vb.html written by Static...it might be of use
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Sep 11th, 2006, 08:34 AM
#3
Fanatic Member
Re: Auto Fill Web Control Form
You could use this:
VB Code:
Web.Document.All("user").value = "username"
Web.Document.All("pass").value = "password"
-
Sep 11th, 2006, 08:41 AM
#4
-
Sep 11th, 2006, 08:53 AM
#5
Thread Starter
New Member
Re: Auto Fill Web Control Form
Hi, Thank you for your help. I had a look at the website. I am going though the google tutorial and trying to add 'Static' to the search box. but i get a message saying "user definded type not defined" and vb points to
Dim HTML As HTMLDocument.
Can you help me please?
-
Sep 11th, 2006, 09:07 AM
#6
PowerPoster
Re: Auto Fill Web Control Form
And I quote from a part of the site:
"Lets introduce the HTML Object library. Go to the Project menu and select References. Then pick, Microsoft HTML Object Library."
That'll fix it :-)
 Originally Posted by Static
Wow, thanks for the mention smUX  first time ive seen someone link my site.. kinda cool 
I've mentioned your site about 5 or 6 times now :-P
Well, everyone else has been doing it :-)
Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
Expect more to come in future
If I have helped you, RATE ME! :-)
I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!
And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.
-
Sep 11th, 2006, 09:14 AM
#7
Thread Starter
New Member
Re: Auto Fill Web Control Form
I have added the Microsoft HTML Object Library. And useing the HTML.All.Item("q").Value = "Static"
Google now loads without any errors but the search bos does not display 'Static'.
Any ideas as to why?
-
Sep 11th, 2006, 09:19 AM
#8
Re: Auto Fill Web Control Form
post the code. where are u calling the code to set it to Static?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 11th, 2006, 09:23 AM
#9
Thread Starter
New Member
Re: Auto Fill Web Control Form
Here is the code. Many thanks for all of your help.
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.google.com/"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Application) Then
If URL = "http://www.google.com/" Then
Dim HTML As HTMLDocument
Set HTML = WebBrowser1.Document
'HTML.All.q.Value = "Static"
HTML.All.Item("q").Value = "Static"
End If
End If
End Sub
-
Sep 11th, 2006, 09:29 AM
#10
Re: Auto Fill Web Control Form
?? it doesnt? i pasted that code in and it works fine...
are u sure u are waiting till the page loads?
change it to this so u know if its running all of that:
VB Code:
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.google.com/"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Application) Then
If URL = "http://www.google.com/" Then
Dim HTML As HTMLDocument
Set HTML = WebBrowser1.Document
MsgBox "ABout to put STATIC in..."
HTML.All.Item("q").Value = "Static"
MsgBox "Static Should be there now"
End If
End If
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Sep 11th, 2006, 09:40 AM
#11
Thread Starter
New Member
Re: Auto Fill Web Control Form
It works, I found that google was redirecting to co.uk once loaded so the ' If URL = "http://www.google.com/" Then' code did not run. But i have chnaged to .co.uk and it works fine now.
Thank you ever so much, I really did'nt ecpect so much help so quick. Its nice to know there are people willing to help each other.
Once again,
Many Thanks
-
Sep 11th, 2006, 09:46 AM
#12
Re: Auto Fill Web Control Form
.... u have found the best place on the web for VB help.
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|