hey every one

happy Halloween ^__^

i'm trying to make a log in system but i have a small problem

the problem is i want the user name to be not Sensitive to the capital letter and small letter e.x if the user name is ari and password is IT

i can write ari as any way like : Ari , ARi , ArI but the password must be it

here is my code :

Public Class Form1
    Dim user As String = "ari"




    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = user And TextBox2.Text = "IT" Then
            MessageBox.Show("ok")
        Else

            MessageBox.Show("wrong password")
        End If


    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

    End Sub
End Class

thanks ...ari~

Recommended Answers

All 4 Replies

Convert the input to lowercase and compare it .

Convert the input to lowercase and compare it .

can you tell me how to do that ?

iam new in programing

If TextBox1.Text.ToLower = User.ToLower And TextBox2.Text.ToLower = "it" Then

You could also use string.Compare() :

Dim s1 As String = String.Empty
Dim s2 As String = String.Empty
If (String.Compare(s1, s2, True) = 0) Then
	'Correct
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.