forms login and password help

Posted on 2004-11-13
Last Modified: 2010-05-02
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*
Question by:chrisyroid
    LVL 48

    Accepted Solution

    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
    LVL 48

    Expert Comment

    by:Ryan Chong
    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

    Author Comment

    I laso want to know how to do this with asp
    LVL 48

    Expert Comment

    by:Ryan Chong
    >>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.

    LVL 48

    Expert Comment

    by:Ryan Chong
    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..

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now