private void button1_Click(object sender, EventArgs e) { int v1, v2, v3, v4; string s = maskedTextBox1.Text; //------------------------------------------------------------ WAY 1 TO SEPERATE THE NUMBER TO 4 DIGITS char[] y1 = s.ToCharArray(); v1 = (Int32)y1[15] - 48; v2 = (Int32)y1[16] - 48; v3 = (Int32)y1[17] - 48; v4 = (Int32)y1[18] - 48; if (click == 1) { ConfigurationSettings.AppSettings.Set("1", $"{v1}"); ConfigurationSettings.AppSettings.Set("2", $"{v2}"); ConfigurationSettings.AppSettings.Set("3", $"{v3}"); ConfigurationSettings.AppSettings.Set("4", $"{v4}"); label1.Text = "player " + askingform.n2 + " please enter your number and do 'nt let the other player see it"; click++; maskedTextBox1.Clear(); maskedTextBox1.Focus(); } else { ConfigurationSettings.AppSettings.Set("5", $"{v1}"); ConfigurationSettings.AppSettings.Set("6", $"{v2}"); ConfigurationSettings.AppSettings.Set("7", $"{v3}"); ConfigurationSettings.AppSettings.Set("8", $"{v4}"); p2.Show(); p1.Show(); foreach (Control c in p2.Controls) { if (c is MaskedTextBox || c is Button) { c.Enabled = false; } } this.Hide(); } }
//int k=1; private void callplayer2(player2 p2) { p2.Show(); }