Int textBox
-
Hi, I finally figured how to parse my string as singles but I am looking for a way to prevent the user from entering non numeric values in the textBox, could a maskEdit do this or is there a way to do it directly with the textBox. Thanks Jean S. Paquet // JS Paquet cout << "Thank you all" << endl;
-
Hi, I finally figured how to parse my string as singles but I am looking for a way to prevent the user from entering non numeric values in the textBox, could a maskEdit do this or is there a way to do it directly with the textBox. Thanks Jean S. Paquet // JS Paquet cout << "Thank you all" << endl;
Just handle the KeyPress event of the textbox check each character...
textBox1.KeyPress += new new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (!Char.IsDigit (e.KeyChar)) { e.Handled = true; } }
Andreas Philipson
-
Just handle the KeyPress event of the textbox check each character...
textBox1.KeyPress += new new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (!Char.IsDigit (e.KeyChar)) { e.Handled = true; } }
Andreas Philipson