开发者

How to convert textbox.text into int or what to use for int only input instead?

How do I c开发者_如何学JAVAonvert a TextBox to int or is there a box inside WPF that supports only numbers?


To convert string to int you can use, Parse:

string text = "1234";
int value = int.Parse(text);

Or you could use NumericUpDown control.


If you only want numeric input, you might be better off with numbericupdown. Of course, you could just validate the input using tryparse...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜