Hello everyone i made C# program and i want to make textbox only accept Number i tryed many different code and i get same errors please help this is my code
private void agetxt_Click(object sender, EventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
}
and this is the error message i get
Error CS1061 'EventArgs' does not contain a definition for 'KeyChar' and no extension method 'KeyChar' accepting a first argument of type 'EventArgs' could be found (are you missing a using directive or an assembly reference?) WindowsFormsApplication1 C:\Users\ziadm\Documents\Visual Studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form2.cs 176 Active