Minimum = 0;
Maximum = 9999;

解决方案 »

  1.   

    我问的意思是在NumerUpDown框中输入数字时,如限制输入了数字长度为4,当输入弟五位数时,要禁止输入,如何实现谢谢:) 请指教,如只能输9999 ,99999就不可
      

  2.   

    在onkeydown事件你判断一下就行了.
      

  3.   

    if(numericUpDown1.Value.ToString().Length>4)
    {
    }
      

  4.   

    KeyDown中判斷是否"-"號
    if (e.KeyValue == 189 || e.KeyValue == 109)//"-"(key broad) or "-"(num pad)
    {
    txtPrice.Value = txtPrice.Minimum;
    e.Handled = false;
    }
    KeyUp中判斷
      

  5.   

    靠,沒寫完就被提交了KeyDown中判斷下限,是否為"-"號if (e.KeyValue == 189 || e.KeyValue == 109)//"-"(key broad) or "-"(num pad)
    {
      txtPrice.Value = txtPrice.Minimum;
      e.Handled = false;
    }KeyUp中判斷上限if(Convert.ToInt32(txtPrice.Value) > txtPrice.Maximum)
    {
      txtPrice.Value = txtPrice.Maximum;
      e.Handled = false;
    }
      

  6.   

    ((TextBox)NumericUpDown.GetChildAtPoint(new Point(1,1))).MaxLength = 4;