Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 244,308 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 830 people online right now. Registration is fast and FREE... Join Now!




Username and password in VB.Net

 
Reply to this topicStart new topic

Username and password in VB.Net

gjay
9 Oct, 2008 - 07:15 PM
Post #1

New D.I.C Head
*

Joined: 9 Oct, 2008
Posts: 1

CODE

Private Sub Button1_Click(ByVal sender As System.Object. ByVal e As System.EventArgs) Handles Button1.Click
Dim Student, geejay As String
If Me.TextBox1.Text="Student" And Me.TextBox2="geejay" Then
MsgBox ("You may Start using the system")
me.Hide()
Form2.Show()
Else
MsgBox("Wrong Username/PAssword",1)
End If
End Sub



User is offlineProfile CardPM
+Quote Post


PsychoCoder
RE: Username And Password In VB.Net
9 Oct, 2008 - 07:28 PM
Post #2

loves.Coding(this);
Group Icon

Joined: 26 Jul, 2007
Posts: 12,288



Thanked: 372 times
Dream Kudos: 10775
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

My Contributions
Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:

  • Post the code you're having problems with (DONE)
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field

User is offlineProfile CardPM
+Quote Post

xkermit
RE: Username And Password In VB.Net
10 Oct, 2008 - 12:14 AM
Post #3

New D.I.C Head
*

Joined: 12 Oct, 2007
Posts: 25



Thanked: 2 times
My Contributions
QUOTE(gjay @ 9 Oct, 2008 - 08:15 PM) *

CODE

Private Sub Button1_Click(ByVal sender As System.Object. ByVal e As System.EventArgs) Handles Button1.Click
Dim Student, geejay As String
If Me.TextBox1.Text="Student" And Me.TextBox2="geejay" Then
MsgBox ("You may Start using the system")
me.Hide()
Form2.Show()
Else
MsgBox("Wrong Username/PAssword",1)
End If
End Sub



your code looks good for me. Sorry I can't help.

btw, i need some help for login form using Access database.
I have been doing this so far and can't go any further since I don't have any idea how to check the database and compare it one by one.

This is my code
CODE

        Dim conn As OleDb.OleDbConnection
        Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;_
        Data Source=.\Resources\Respondent.mdb;Jet OLEDB:Database Password=xxx"

        conn = New OleDb.OleDbConnection(connectionString)
        conn.Open()

        //This is where I don't have any idea how to get the data from access, compare
        //the username, check the password and compare them, pass it back to the
        //VB2005 and do the autentification process

        conn.Close()
        conn.Dispose()


I'm not sure how to compare queries with text component in the textbox.

Any idea?
User is offlineProfile CardPM
+Quote Post

matto
RE: Username And Password In VB.Net
18 Apr, 2009 - 08:09 AM
Post #4

New D.I.C Head
*

Joined: 18 Apr, 2009
Posts: 32

I think you need to start your own topic in the help section
User is offlineProfile CardPM
+Quote Post

microstoc
RE: Username And Password In VB.Net
18 Apr, 2009 - 08:54 AM
Post #5

D.I.C Head
**

Joined: 4 Apr, 2009
Posts: 59



Thanked: 5 times
My Contributions

As I look into my crystal ball ....

CODE

Me.TextBox2="geejay"


Could that be it ?
User is offlineProfile CardPM
+Quote Post

LemonMan
RE: Username And Password In VB.Net
18 Apr, 2009 - 03:15 PM
Post #6

D.I.C Head
Group Icon

Joined: 22 Aug, 2005
Posts: 170



Thanked: 12 times
Dream Kudos: 205
My Contributions
microstoc is right. Try this:

CODE

Me.TextBox2="geejay"


But thank him and not me because I didn't find the error. wink2.gif
User is offlineProfile CardPM
+Quote Post

waquas
RE: Username And Password In VB.Net
6 May, 2009 - 10:49 AM
Post #7

New D.I.C Head
*

Joined: 16 Apr, 2009
Posts: 1

It should be like this:

Me.TextBox2.Text="geejay"

You forgot to write '.Text' after textbox2
User is offlineProfile CardPM
+Quote Post

Dazastah
RE: Username And Password In VB.Net
8 May, 2009 - 05:12 AM
Post #8

New D.I.C Head
*

Joined: 15 Apr, 2009
Posts: 29

maybe try this.
CODE
If UserTxt.text = "Student" And PassTxt.text = "geejay" Then
Msgbox("You may start using the system", MsgBoxStyle.Information, "Permitted")
Me.hide
Form2.show
Else
Msgbox("Sorry, you have the wrong Username/Password", MsgBoxStyle.Exlamation, "Oops!")
PassTxt.Text = ""


The textboxes names should be
User Name Textbox= UserTxt
Pass Word Textbox= PassTxt

That should be easier then the rest.
User is offlineProfile CardPM
+Quote Post

Bueller
RE: Username And Password In VB.Net
8 May, 2009 - 01:49 PM
Post #9

New D.I.C Head
*

Joined: 14 Mar, 2009
Posts: 1

Try this:

CODE

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim username As String = "Someusername"
        Dim password As String = "Somepassword"

        If TextBox1.Text = username And TextBox2.Text = password Then
            MsgBox("You may Start using the system")
            Me.Hide()
            Form2.Show()
        Else
            MsgBox("Wrong Username/Password", 1)
        End If
    End Sub

User is offlineProfile CardPM
+Quote Post

rgfirefly24
RE: Username And Password In VB.Net
8 May, 2009 - 02:40 PM
Post #10

D.I.C Regular
Group Icon

Joined: 7 Apr, 2008
Posts: 403



Thanked: 7 times
Dream Kudos: 150
My Contributions
Just wanted to point out that you guys are answering a question from a year ago that was posed by someone who i would take a guess is not on the forums anymore smile.gif

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 07:05PM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month