how enter numbers looks like integer in textbox in c# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how enter numbers looks like integer in textbox in c#

1st Jun 2017, 12:46 AM
ALAMOUDI, WAEL MAKKI S
ALAMOUDI, WAEL MAKKI S - avatar
5 Answers
+ 5
if you get the numbers from the textbox you will need parsing them
1st Jun 2017, 1:27 AM
Angel León
Angel León - avatar
+ 4
@wail when you get numbers from a textbox, those "numbers" are text, so if you need use them for some reason, you will need convert that "numbers" into some type, for example, if you get "505" from a textbox, 505 is a string, so to convert that "number" to a integer, you would coding something like int myNumber = int.Parse("505")
1st Jun 2017, 2:12 AM
Angel León
Angel León - avatar
+ 2
try this texbox1 is the textbox try{ int no = int.Parse(textbox1.Text); }Catch(Exception e){ MessageBox.Show("enter a valid number"); }
1st Jun 2017, 6:25 AM
MR Programmer
MR Programmer - avatar
0
what you mean parsing them
1st Jun 2017, 1:57 AM
ALAMOUDI, WAEL MAKKI S
ALAMOUDI, WAEL MAKKI S - avatar
0
Angel can you give me simple example
1st Jun 2017, 3:21 PM
ALAMOUDI, WAEL MAKKI S
ALAMOUDI, WAEL MAKKI S - avatar