gpt4 book ai didi

c# - 验证文本框以仅允许数值

转载 作者:太空狗 更新时间:2023-10-29 22:05:12 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
How do I make a textbox that only accepts numbers?

我有一个电话号码,我希望将其存储为一个字符串。

我在使用中阅读了这个

txtHomePhone.Text

我想我需要的是某种数字但无法让它工作

if (txtHomePhone.Text == //something.IsNumeric)
{
//Display error
}
else
{
//Carry on with the rest of program ie. Add Phone number to program.
}

只允许输入数值的最佳方法是什么?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com