检查TextBox中的用户输入数字?请帮忙 :) [英] Checking user input in a TextBox for numbers?? help please :)
问题描述
大家好,
我遇到了以下问题的困难,这让我疯狂地试图寻找解决方案,我一直在这么多的论坛和网络上搜索,但没有任何帮助。
基本上在我的Windows Phone 7应用程序中,我有一个文本框供用户输入其重量lbs,但如果用户输入除int之外的任何内容,则整个程序崩溃。 如何添加一些用于检查用户输入内容的代码,如果
是一个数字,它执行我想要的计算,但除了数字之外的任何内容都会显示"请仅输入一个数字"。消息类型。
这听起来很简单,但我似乎无法弄明白。
请帮忙!! :)
非常感谢
<保罗
检查
InputScope ,并确保使用InputScope = TelephoneNumber,它只允许数值。
Hi all,
I'm having difficulties with the following problem and it's driving me crazy trying to find a solution, I've been on so many forums and web searches but nothing is helping.
Basically in my Windows Phone 7 app I have a textbox for the user to enter in their weight in lbs, but if the user inputs anything other than in int then the whole program crashes. How do I add some code that checks what the user has inputted and if it is a number it does the calculation I want it to do, but anything other than a number displays a "please enter a number only please" type of message.
It souds simple, but Ijust can't seem to figure it out.
Please help!! :)
Many thanks
Paul
Check the InputScope for the text boxes and make sure yo use InputScope = TelephoneNumber which allows only numeric values.
这篇关于检查TextBox中的用户输入数字?请帮忙 :)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!