判断输入的时候为整数

 
     private TextBox m_TextBox = null;

 m_TextBox.LostFocus += new EventHandler(m_TextBox_LostFocus_positive);

        void m_TextBox_LostFocus_number(object sender, EventArgs e)
        {
            TextBox textbox = sender as TextBox;
            if (textbox != null)
            {
                double dbValue = 0;

                if (!double.TryParse(textbox.Text, out dbValue))
                {
                    textbox.Text = null;
                }
            }
        }

你可能感兴趣的:(object,null,textbox)