C# numericUpDown控件的使用


namespace WindowsFormsApplication106
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
try
{
numericUpDown1.DecimalPlaces = int.Parse(textBox1.Text);
}
catch
{
MessageBox.Show("输入的值有误");
textBox1.Clear();
}
}

private void Form1_Load(object sender, EventArgs e)
{
label1.Text = "将显示的值";
}

private void button2_Click(object sender, EventArgs e)
{
try{
numericUpDown1.Increment = int.Parse(textBox2.Text);
}

catch
{
MessageBox.Show("输入的值有误");
textBox2.Clear();
}
}

private void button3_Click(object sender, EventArgs e)
{
numericUpDown1.UpButton();
}

private void button4_Click(object sender, EventArgs e)
{
numericUpDown1.DownButton();
}

private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
label1.Text = numericUpDown1.Value.ToString();
}

}

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM