C# 纯数字文本框控件 [英] C# Numeric Only TextBox Control

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

问题描述

我使用的是 C#.NET 3.5,但我的项目有问题.在 C# Windows 应用程序中,我想让 textbox 只接受数字.如果用户尝试输入字符,消息应该显示为请仅输入数字",并且在另一个文本框中它必须接受有效的 email 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: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# 纯数字文本框控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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