Results 1 to 3 of 3

Thread: Adding a login

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2011
    Posts
    32

    Adding a login

    I want to make a login for my application, not using a database, for now.

    I figured something like this:

    Code:
    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
    
            If UsernameTextBox.Text = "Josh" & PasswordTextBox.Text = "mypass1" Then
                Me.Hide()
            Else If
                MsgBox("Sorry User Name Or Passord Is Incorrect")
            End If
    
        End Sub
    Im getting a cannot convert to boolean or something.

    Please help, very new to this. Some Java experience

  2. #2

    Thread Starter
    Member
    Join Date
    Aug 2011
    Posts
    32

    Re: Adding a login

    Actually I think i got it.

    Code:
    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
    
            If UsernameTextBox.Text = "Josh" AndAlso PasswordTextBox.Text = "mypass1" Then
                MsgBox("Login Successful")
                Form1.Show()
                Me.Hide()
            End If
    
        End Sub
    Only one thing:
    Doing this only hides the login form. I tried Me.Close() but it closes the whole program.

    Is there an IgnoreCase function to make the fields case insensitive
    Last edited by Jtsou; Sep 21st, 2011 at 10:51 PM.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Adding a login

    Follow the CodeBank link in my signature and check out my WinForms Login thread.

    The String.Equals function can be case-sensitive or -insensitive.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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