Now i want to check whether the windows user entering the correct password or not .
for example:
in textbox1=username
in textbox2=password
onclicking the ok button if it is the right password to that user or not,if it is valid user means in messagebox("valid user") else invalid user.how to i check this...Help me..

You have to check the values of textboxes against preload data of user. If user's data is in database, you have to use ADO.NET classes.

For example, if the password was "abcd123"
You would use this:

if(this.textBox2.Text = "abcd123")
{
             MessageBox.Show("Valid user");
}
else
{
           MessageBox.Show("Invalid user");
}

Hope this helps :P

For example, if the password was "abcd123"
You would use this:

if(this.textBox2.Text = "abcd123")
{
             MessageBox.Show("Valid user");
}
else
{
           MessageBox.Show("Invalid user");
}

Hope this helps :P

No, code has an error.

if(this.textBox2.Text == "abcd123")
{
             MessageBox.Show("Valid user");
}
else
{
           MessageBox.Show("Invalid user");
}
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.