Hi all , I am a beginner in C# , and making a calculator . But i want to disable the "GO!" button when there's no number typed in textbox1 and once the user enters a number in it the "GO!" button becomes enabled again ... how to do this in C# ? i tried KeyDown and KeyPress event like this but never worked
private void Form1_Load(object sender, EventArgs e)
{
button15.Enabled = false;
button16.Enabled = false;
}
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
{
button15.Enabled = true;
button16.Enabled = true;
}
else
{
button15.Enabled = false;
button16.Enabled = false;
}
}
so how to do this please ? thanks in advance .