Results 1 to 12 of 12

Thread: Auto Fill Web Control Form

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    8

    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,

  2. #2
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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.

  3. #3
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Auto Fill Web Control Form

    You could use this:
    VB Code:
    1. Web.Document.All("user").value = "username"
    2. Web.Document.All("pass").value = "password"
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Auto Fill Web Control Form

    Wow, thanks for the mention smUX first time ive seen someone link my site.. kinda cool

    atmosphere.. its really fairly easy to do.. read the tutorial, it should help get u rolling. if u get stuck, just post what u are stuck on and we will help


    and.. WELCOME!
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    8

    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?

  6. #6
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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 :-)


    Quote 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.

  7. #7

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    8

    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?

  8. #8
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    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"

  9. #9

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    8

    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

  10. #10
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    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:
    1. Private Sub Form_Load()
    2.     WebBrowser1.Navigate "http://www.google.com/"
    3. End Sub
    4.  
    5. Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    6.     If (pDisp Is WebBrowser1.Application) Then
    7.        
    8.         If URL = "http://www.google.com/" Then
    9.            
    10.             Dim HTML As HTMLDocument
    11.             Set HTML = WebBrowser1.Document
    12.             MsgBox "ABout to put STATIC in..."
    13.             HTML.All.Item("q").Value = "Static"
    14.             MsgBox "Static Should be there now"
    15.         End If
    16.        
    17.     End If
    18. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  11. #11

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    8

    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

  12. #12
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    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
  •  



Click Here to Expand Forum to Full Width