CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2008
    Posts
    73

    [RESOLVED] login form problem 2

    here is the code i am using:
    Code:
    Public Class LoginForm1
          
    
        Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
            If Me.UsernameTextBox.Text = "" And Me.PasswordTextBox.Text = "" Then
    
                Dim form As New Form
    
                Form1.Show()
    
                Me.Hide()
    
            Else
    
                MsgBox("Could not verify your identity. Invalid username or password.")
    
                PasswordTextBox.Text = ""
    
                UsernameTextBox.Text = ""
    
                UsernameTextBox.Select()
    
            End If
    
    
    
    
            Me.Close()
    
        End Sub
    
        Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
            Me.Close()
        End Sub
    
        Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub UsernameLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UsernameLabel.Click
    
        End Sub
    after correct info is entered it doesnt load form1. any help? thankyou

  2. #2
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: login form problem 2

    Well you say Dim Form as New Form and then Form1.Show?
    Sounds wrong to me.
    Try Form.Show, this is the object you have initialized.

  3. #3
    Join Date
    Jan 2008
    Posts
    73

    Re: login form problem 2

    it still does not bring me to form1 after information has been entered

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: login form problem 2

    Take out the me.close and it works.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Jan 2008
    Posts
    73

    Re: login form problem 2

    thankyou that works great.

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

Featured