السلام عليكم
بليز ياجماعة ابغى شرح للكود هذا
او رابط او كتاب يشرح الجزئيه هذي
private void Form1_Load(object sender, EventArgs e)
{
panel1.Visible = true;
panel2.Visible = false;
foreach (Control cc in Controls)
{
TextBox tb = cc as TextBox;
if (tb != null)
tb.KeyPress += new KeyPressEventHandler(textBox_char);
}
}
private void button2_Click(object sender, EventArgs e)
{
foreach (Control cc in Controls)
{
TextBox tb = cc as TextBox;
//tb.KeyPress = new KeyPressEventHandler(textBox_char);
if (tb != null)
tb.Text = "";
}
isEmpty = true;
}
public void textBox_char(object sender, KeyPressEventArgs e)
{
if (isArithmetic == false)
e.Handled = !("01".Contains(e.KeyChar.ToString()) || e.KeyChar == 8);
else
{
if (!char.IsDigit(e.KeyChar) && e.KeyChar != (char)8)
{
e.Handled = true;
}
}
}شكرا