Password to reach one form to another.Please help me.tq very much.
-
There have two form which is form1 and form2. In form1 user have to keyin the right password which we give them. If user keyin in teh textbox the password and click (OK button).If the password is same with the password we set.They can link to other form. FOR FORM1: private void textBox1_TextChanged(object sender,EventArgse) { // The password character is an asterisk. textBox1.PasswordChar ='*'; // The control will allow no more than 4 characters. textBox1.MaxLength = 4; // } private void button1_Click(object sender, EventArgs e) { Form Other = new Form2(); Other.show(); } *****What should I add in this two object so that: 1: In textbox keep user input 2: Verify in OK button object with our password to log in to form2. TQ VERY MUCH..... Email: krajah20@yahoo.com
-
There have two form which is form1 and form2. In form1 user have to keyin the right password which we give them. If user keyin in teh textbox the password and click (OK button).If the password is same with the password we set.They can link to other form. FOR FORM1: private void textBox1_TextChanged(object sender,EventArgse) { // The password character is an asterisk. textBox1.PasswordChar ='*'; // The control will allow no more than 4 characters. textBox1.MaxLength = 4; // } private void button1_Click(object sender, EventArgs e) { Form Other = new Form2(); Other.show(); } *****What should I add in this two object so that: 1: In textbox keep user input 2: Verify in OK button object with our password to log in to form2. TQ VERY MUCH..... Email: krajah20@yahoo.com
I assume the following. You want the user the enter the password in one form. If the password, matches with some default/inbuilt/from the database password, then it should go to the second form. I also assume that you have a default password stored for comparison. We'll Here it is. You have to validate the password in the same form. Form1 fm1 = new Form1(); Form2 fm2 = new Form2(); string DefaultPassword = "pass"; string PasswordCharacter = textBox1.Text; if (PasswordCharacter==DefaultPassword) { fm2.Show(); fm1.Hide(); } I hope this helps.
Keshav Kamat :) India
-
There have two form which is form1 and form2. In form1 user have to keyin the right password which we give them. If user keyin in teh textbox the password and click (OK button).If the password is same with the password we set.They can link to other form. FOR FORM1: private void textBox1_TextChanged(object sender,EventArgse) { // The password character is an asterisk. textBox1.PasswordChar ='*'; // The control will allow no more than 4 characters. textBox1.MaxLength = 4; // } private void button1_Click(object sender, EventArgs e) { Form Other = new Form2(); Other.show(); } *****What should I add in this two object so that: 1: In textbox keep user input 2: Verify in OK button object with our password to log in to form2. TQ VERY MUCH..... Email: krajah20@yahoo.com
Just put a check to validate the user entered password with the default password. If both are same, the show the form2. Thats it.. public partial class Form1 : Form { Form2 form2 = new Form2(); public Form1() { InitializeComponent(); Password.PasswordChar = '*'; //Masking Char } private void Form1_Ok_Click(object sender, EventArgs e) { string strDefaultPassword = "ABCD"; //Keep ur default passowrd string strEnteredPassword = Password.Text; if(strEnteredPassword == strDefaultPassword ) { this.hide(); form2.ShowDialog(); } else { MessageBox.Show("Wrong password entered"); this.Close(); } } }
Thanks & Rgds, Sri..