这段VB程序是一个if的选择语句,结果是d在text2中显示运算结果,现在该if语句中当A1=2是,总是显示-1,也就是无法运行,请问各位应该怎么修改才能运行啊?Dim A1 As Integer Private Sub Combo1_Change() If Combo1.ListIndex = 0 Then A1 = 1 ... 展开
这段VB程序是一个if的选择语句,结果是d在text2中显示运算结果,现在该if语句中当A1=2是,总是显示-1,也就是无法运行,请问各位应该怎么修改才能运行啊?Dim A1 As Integer Private Sub Combo1_Change() If Combo1.ListIndex = 0 Then A1 = 1 If Combo1.ListIndex = 1 Then A1 = 2 End Sub Private Sub Command1_Click() Dim a, b, c, d As Integer a = val(Text1.Text) If A1 = 1 Then b = Int(a / 6) + 1 c = 6 * b - 3 ElseIf A2 = 2 Then b = Int(a + 1.5) / 3 c = 3 * b End If d = a - c Text2.Text = cstr(d) End Sub Private Sub Form_Load() Combo1.AddItem "1"Combo1.AddItem "2"End Sub 收起