954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

validate registraion form in VB.Net

Hi All,

I've created a registration form in VB.Net. Now I want to validate it, like if the username is previously used by some one then it wont allow to register. I can do it in ASP.Net, But I m not able to find any solution for VB.Net. If any body have any code snnipet then plz send me or give me few suggestion.

Thanks
M

mpatram
Newbie Poster
9 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

you just check each of the value in registration form with data in your database, what the problems...
if u can save and show data from database so its not difficult to validate registration from with database.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

if you can do in asp.net with vb, it think you can do the same. so what the effort of your code?

Estella
Junior Poster in Training
99 posts since Jan 2008
Reputation Points: 64
Solved Threads: 7
 

for validation you have to follow this


1 compare the text value with each user name record field.

2. if any record find out with same name you have to given message to user "user name all ready used by some one you have to chose another name" .


3. if no record is found create and save to data base.


for any type of web related information you can visit
http://webdesigningcompany.net

bector
Newbie Poster
13 posts since Jan 2008
Reputation Points: 7
Solved Threads: 2
 

Please use following code with Text box validation with validate in Validating Event
http://www.java2s.com/Code/VB/GUI/TextBoxvalidationvalidateinValidatingEvent.htm

Please ask for any suggestion on website development please visit
http://www.technopus.com

dhavalparmar
Newbie Poster
1 post since Oct 2011
Reputation Points: 10
Solved Threads: 0
 
'declare connectionstring to server

    'assuming your table name where users are stored is called 'Users' 
    'and the column name to verify a user is called 'username'

    Dim SelectStmt As String = "SELECT * FROM users WHERE UserName ='" +   userNameTextBox.Text + "' and " + _
                "Password ='" + passwordTextBox.Text + "'"

    Dim dc As SqlCommand = New SqlCommand(SelectStmt, con) 'assming your connectionstring is called 'con'

    Dim reader As SqlDataReader = objcommand.ExecuteReader

    If reader.Read Then

	'enter codes on what the system should do if the user exists

    Else

   MessageBox.Show("Invalid Username or Password!", "Login Error", _
                MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning)
    End if
Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You