最近我创建了一个pos,但我想使用组合框而不是单选按钮来选择税收选项,但我如何选择我想要的税并进行数学运算: 这是我的单选按钮代码,我想用组合框
来做Dim SellPrice as Double
Dim Tax as Double
Dim FinalPrice
if radiobutton1=checked=true than
Final price *=Sellprice *0.18
else if radiobutton2=checked=true than
Final price *=Sellprice *0.5
end if
我想做同样的事情,但要使用组合框而不是无线电按钮
答案 0 :(得分:0)
在表格中加载:
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("0.18")
ComboBox1.Items.Add("0.5")
'Add other values if you wan
End sub
验证按钮中的:
Private Sub BtnValidate_Click(sender As Object, e As EventArgs) Handles BtnValidate.Click
Dim SellPrice As Double
Dim Tax As Double
Dim FinalPrice
If ComboBox1.SelectedIndex > -1 Then
Tax = Convert.ToDouble(ComboBox1.Text)
FinalPrice *= SellPrice * Tax
End If
End Sub