if (fromListBox.SelectedIndex = 0 && toListBox.SelectedIndex = 1)
input /= 12;
else if (fromListBox.SelectedIndex = 0 && toListBox.SelectedIndex = 2)
input /= 36;
else if (fromListBox.SelectedIndex = 1 && toListBox.SelectedIndex = 0)
input *= 12;
else if (fromListBox.SelectedIndex = 1 && toListBox.SelectedIndex = 2)
input /= 3;
else if (fromListBox.SelectedIndex = 2 && toListBox.SelectedIndex = 0)
input *= 36;
else if (fromListBox.SelectedIndex = 2 && toListBox.SelectedIndex = 1)
input *= 3;
我做错了什么?如何从不同的列表框中提取数据进行计算?
这是一个距离转换应用程序;用户在startingDistanceTextBox
中输入一个数字,从fromListBox
中选择衡量标准,并将其转换为toListBox
;项目是:英寸,英尺和英尺码(两个列表框)。我要在标签中显示转换。