67 279
Assignments Done
99,1%
Successfully Done
In November 2018

Answer to Question #28205 in C# for dhivya muthu

Question #28205
how to create a login form with validation,sign in ,signout,register using c#windows application
Expert's answer
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions