博客园 :: 首页 :: 联系 :: 订阅 订阅 :: 管理
  14 Posts :: 4 Stories :: 22 Comments :: 0 Trackbacks
using System;
using System.Windows.Forms;

namespace Northwind
{
    
/// <summary>
    
/// Summary description for NumericTextBox.
    
/// </summary>

    public class NumericTextBox  : TextBox
    
{
        
public NumericTextBox()
        
{
            
        }

        
        
protected override void OnKeyPress(KeyPressEventArgs e)
        
{
            
if (!char.IsDigit(e.KeyChar))
            
{
                e.Handled 
= true;
            }

        }


    }

}

使用该继承的控件,可以实现只允许输入数字.
posted on 2005-08-06 13:32 Liu 阅读(356) 评论(0)  编辑 收藏 所属分类: .Net设计

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      


相关链接: