试图在NumericUpDown中从成本中减去设置

时间:2015-04-09 21:26:26

标签: c# numericupdown

我想从setup中减去cost。所以,我需要从NumericUpDown框中获取值并将其存储为一个整数,然后我可以用它来减去setup

public partial class Form1 : Form
{
    int setup = 100;
    int finalcost;
    int cost;
    int priority;

    public Form1()
    {
        InitializeComponent();
    }

    private void button2_Click(object sender, EventArgs e)
    {
        priority = trackBar1.Value;
        int cost = (int)numericUpDown1.Value;
        if (radioButton1.Checked)
        {

            finalcost = cost - setup;
            MessageBox.Show(finalcost.ToString());
        }
    }

1 个答案:

答案 0 :(得分:0)

NumericUpDown Maximum属性设置为高于100。