private void button4_Click(object sender, EventArgs e) { try { //elegxei an ayto to pass pou evale ox rhsths einai idio me to repeat pass if (passBox.Text == passboxrpt.Text) { success.Play(); //an einai swsta ta pass pou evale tote prosthetei sto dictionary to user kai pass accounts.Add(usertext.Text, passBox.Text); MessageBox.Show("Account created succesfully"); //eksafanizei to panel pou kaname registry Registerpanel.Hide(); } else { fail.Play(); System.Threading.Thread.Sleep(500); //an valei diaforetika pass tou vgazei to parakatw mnm MessageBox.Show("Password mismatch"); } } //an kapoios dwsei idia stoixeia me ayta poy einai hdh sto leksiko mesa //mhn crasharei alla na vgalei ena mnm catch (Exception ex) { fail.Play(); System.Threading.Thread.Sleep(500); //MessageBox.Show(ex.Message); MessageBox.Show("Account " + usertext.Text + " " + "already exists!"); } }
public Form1() { InitializeComponent(); //kryvw to deftero panel Registerpanel.Hide(); //pernei to panel to megethos toy parathyrou kai otan pame na to mikrinoume //den mas afhnei na to mikrynoume pereterw apo to panel this.AutoSize = true; //kanei autosize me vash ti einai panw ths kai den mas afhnei na megalwsoume pereterv h na mikrynoyme this.AutoSizeMode = AutoSizeMode.GrowAndShrink; //φτιαχνς ena account me user:emi ke pass:123 accounts.Add("jim", "123"); //8a pros8eso ke ena deftero account accounts.Add("a", "123"); }