仅数字文本框在Visual Studio工具箱控制 [英] numeric-only textbox as a control in Visual Studio toolbox
本文介绍了仅数字文本框在Visual Studio工具箱控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想提出一个数字,只有文本框。我想然后添加相同的控件工具箱的Visual Studio 2008中的
I would like to make one numeric-only textbox. I'd like to then add that same to the control toolbox within Visual Studio 2008
我已经建立了功能,只允许数字。
I've already built the function to allow only numeric.
如何使它在工具箱中可用?
How can I make it available in the toolbox?
推荐答案
这是如何创建数字文本框
:
public class NumericTextBox : TextBox
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
{
e.Handled = true;
}
base.OnKeyPress(e);
}
}
这篇关于仅数字文本框在Visual Studio工具箱控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文