[try Beta version]
Not logged in

 
check if text box is integer

Mar 4, 2013 at 10:35pm
Im righting a program and i have a button that when i push, i want it to check the value's of a couple of boxes then store the values in a notpad document. but i cant figure out how to check if the values are integer value, without using a bunch of or's and if's. there is an easy way right? can someone assist me please? =)thank you

1
2
3
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
			 if (textBox1.Text == 
		 }
Mar 4, 2013 at 10:39pm
what gui framework are you using? most of them have a way to specify the input type a textbox can accept so you could always use that type of functionality to limit it do numerical input. Otherwise you just loop through the elements of the string you got from the textbox and use isdigit() on it.
Last edited on Mar 4, 2013 at 10:40pm
Mar 4, 2013 at 10:46pm
im using VS 2010's windows forms application. I couldnt find a property to specify the input type. I might have missed it. i think ill try the isdigit() method.

edit: thanks for the super duper fast reply
Last edited on Mar 4, 2013 at 10:46pm
Topic archived. No new replies allowed.