8.3.10

Checking the entry of a textbox with Regular Expression

If you want to be sure, that the user can just enter a numeric value in a textbox, there is a wise way to check this as following;

private void TextBoxNumericOnly_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar != 8)
{
if ((!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), @"\d+")))
e.Handled = true;
}
}





In the “KeyPress” of textbox the entry is validated with the help of Regular Expression. (e.KeyChar != 8 ensures that backspace is not checked, so that the user can delete his entry with backspace.)

Nvidia's GauGan App

NVIDIA's GauGAN AI Machine Learning Tool creates photorealistic images from Simple Hand Doodling http://nvidia-research-mingyuliu.com/...