只能輸入小數點的測試

| |
[不指定 2008/02/22 14:09 | by Else ]


            if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
            else if (Char.IsPunctuation(e.KeyChar))
            {
                if (e.KeyChar == '.')
                {
                    if (((TextBox)sender).Text.LastIndexOf('.') != -1)
                    {
                        e.Handled = true;
                    }
                }
                else
                {
                    e.Handled = true;
                }
            }


作者:Else 's Blog
地址:http://www.aixq.com/post/942/
版权所有。转载时必须链接形式注明作者和原始出处及本声明!
  • 中查看更多“只能輸入小數點的測試”相关内容
  • 中查看更多“只能輸入小數點的測試”相关内容
  • 中查看更多“只能輸入小數點的測試”相关内容
  • 中查看更多“只能輸入小數點的測試”相关内容
  • 中查看更多“只能輸入小數點的測試”相关内容
  • 中查看更多“只能輸入小數點的測試”相关内容
  • 代码 程序 编程 | 评论(0) | 引用(0) | 阅读(2381)
    发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    昵称   密码   游客无需密码
    网址   电邮   [注册]