zoukankan      html  css  js  c++  java
  • combobox和textbox中输入数据为非数字leave时的公用事件,只需要在控件的leave事件中选择本事件即可

    private void tbORcbb_leave(object sender, EventArgs e)
            {
                if (typeof(TextBox).IsInstanceOfType(sender))
                {
                    if (((TextBox)sender).Text.IsNumeric() != true)
                    {
                        ((TextBox)sender).Focus();
                        ((TextBox)sender).SelectAll();
                    }
                }
                else if  (typeof(ComboBox).IsInstanceOfType(sender))
                {
                    if (((ComboBox)sender).Text.IsNumeric() != true)
                    {
                        ((ComboBox)sender).Focus();
                        ((ComboBox)sender).SelectAll();
                    }
                }
            }

  • 相关阅读:
    LeetCode之移除元素
    有被开心到hh(日常)
    交换排序
    插入排序
    顺序查找&折半查找
    C++之引用
    MySQL学习笔记
    C/C++程序编译过程
    计算机面试知识整合(更新中...)
    MFC之编辑框
  • 原文地址:https://www.cnblogs.com/swtool/p/3840196.html
Copyright © 2011-2022 走看看