forms login and password help

I want to submit a username and password from one form and submit it to annother using the webbrowser control to login to a website like this:

enter username and password
*user submits Username and Password*
*form2 hides and form1 shows*

*webbrowser1 shows website then logs into account*
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
In form1 , try insert:

Private Sub Command1_Click()
    Form2.Show vbModal
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set Form1 = Nothing
End Sub

in form 2:

Private Sub Command1_Click()
    Form1.WebBrowser1.Navigate2 "http://www.yourdomain.dom/app/login.html"
    Unload Me
    Do While Form1.WebBrowser1.Busy
    With Form1.WebBrowser1.Document
        .All("loginID").Value = Text1.Text
        .All("password").Value = Text2.Text
    End With    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set Form2 = Nothing
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ryan ChongCommented:
Change these 3 lines accordingly:

>>.All("loginID").Value = Text1.Text
>>.All("password").Value = Text2.Text

means in your HTML form , must got elements of "loginID" , "password" and a submit button named as "Submit" . You need to change it accordingly.

Hope this helps
chrisyroidAuthor Commented:
I laso want to know how to do this with asp
Ryan ChongCommented:
>>I laso want to know how to do this with asp
It's all depends on your web page design whether you want to have a popup login window or not, basically, you can directly put the login form into the web page, and hence a popup login window is NOT necessary.

For futhermore, you can try post a separate question on this issue, since:

* It's consider a New question as it's different from what you asking
* The popup login window issue should ask on ASP/ Javascript TA.

Ryan ChongCommented:
Here is the basic login form, login.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
      function validate(frm) {
            if (frm.loginID.value == "") {
                  alert("Please enter your username.");
                  return false;
            if (frm.password.value == "") {
                  alert("Please enter your password.");
                  return false;
            return true;
<form name="form1" method="post" action="process.asp" onSubmit="return validate(this)">
  <h2><strong>User Login</strong></h2>
    <input name="loginID" type="text" id="loginID">
    <input name="password" type="password" id="password">
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" name="Reset" value="Reset">

Try customize it accordingly.

Also, try close your new open thread, i thought you mean create a totally new form... sorry if that bring misunderstanding..
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.