Answer to Question #28205 in C# for dhivya muthu
how to create a login form with validation,sign in ,signout,register using c#windows application
1
2013-04-15T11:29:36-0400
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
button1.Enabled= false;
txtPassword.Tag= false;
txtLogin.Tag =false;
}
private voidtxtPassword_Validating(object sender, CancelEventArgs e)
{
txtPassword.Tag= Validatinglogic(txtLogin.Text);
ValidatingOK();
}
Provide event handlers on events "Validating"of textbox to volidate login and then to validate login. Below there's an example.
private void ValidatingOK()
{
button1.Enabled= (bool)txtLogin.Tag && (bool)txtPassword.Tag;
}
private voidtxtLogin_Validating(object sender, CancelEventArgs e)
{
txtLogin.Tag =Validatinglogic(txtLogin.Text);
ValidatingOK();
}
private boolValidatinglogic(string text)
{
return text !="";// Your own logic to validate user input (for example empty
fields)
}
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C#
Comments
Leave a comment