C#的数字只有TextBox控件 [英] C# Numeric Only TextBox Control

查看:141
本文介绍了C#的数字只有TextBox控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用C#.net 3.5,我有我的项目中的一个问题。在C#中的Windows应用程序,我想打一个文本只接受数字。如果用户尝试输入字符应该出现像只请输入数字的消息,并在另一个文本框它必须接受有效的电子邮件ID应该出现的消息时,它是无效的。它显示无效的用户ID。

I am using C#.NET 3.5, and I have a problem in my project. In C# Windows Application, I want to make a textbox to accept only numbers. If user try to enter characters message should be appear like "please enter numbers only", and in another textbox it has to accept valid email id message should appear when it is invalid. It has to show invalid user id.

推荐答案

我建议你使用的MaskedTextBox:<一href="http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx">http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx

I suggest, you use the MaskedTextBox: http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx

这篇关于C#的数字只有TextBox控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆