Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Password to reach one form to another.Please help me.tq very much.

Password to reach one form to another.Please help me.tq very much.

Scheduled Pinned Locked Moved C#
comhelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krajah10
    wrote on last edited by
    #1

    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

    K P 2 Replies Last reply
    0
    • K krajah10

      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

      K Offline
      K Offline
      Keshav V Kamat 0
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • K krajah10

        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

        P Offline
        P Offline
        PS Codeproj
        wrote on last edited by
        #3

        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..

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups