Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#组合框和数值上下计算_C#_Combobox - Fatal编程技术网

C#组合框和数值上下计算

C#组合框和数值上下计算,c#,combobox,C#,Combobox,Textbox不显示金额以及如何编码,这样当我从组合框中选择某个内容时,我可以为每个内容指定不同的值?在google中搜索如何在C#中调试。这将解决您的问题,并防止您将来遇到类似的问题! private void submitbutton_Click(object sender, EventArgs e) { if (fishingrodcomboBox.SelectedIndex == 2) { fishingrodcomboBox.SelectedInde

Textbox不显示金额以及如何编码,这样当我从组合框中选择某个内容时,我可以为每个内容指定不同的值?

在google中搜索如何在C#中调试。这将解决您的问题,并防止您将来遇到类似的问题!
 private void submitbutton_Click(object sender, EventArgs e)
 {
    if (fishingrodcomboBox.SelectedIndex == 2)
    {
        fishingrodcomboBox.SelectedIndex = 2;
        decimal two = 18m;
        decimal price = two * fishingrodnumericUpDown.Value;
        totalfishingrodtextBox.Text = price.ToString("C");
    }
    else
    {
           //Do something
    }
}