使用VB6如何显示所有值
我在窗体中使用复选框和组合框。
当我点击复选框,组合框将启用,默认情况下组合框将被禁用。
代码。
Private Sub chkbox1_Click()
combobox1.enable = true
End Sub
Private Sub chkbox2_Click()
combobox2.enable = true
End Sub
输出代码为
If chkbox1.Value = 1 Then
sql2 = "Select * from table1 where value = '" & combobox1 & "' "
ElseIf chkbox2.Value = 1 Then
sql2 = "Select * from table1 where value = '" & combobox2 & "'"
Else
sql2 = "Select * from table1"
End If
上面的代码工作,但是当我点击两个复选框,则需要两个组合框启用,然后我运行查询它显示了combobox1值。
例如
I selected the value = 50 from combobox1 (checkbox1 clicked)
I selected the value = 100 from combobox2 (checkbox2 clicked)
当我运行输出代码
,则输出为显示值,其中值= 50,它没有显示值= 100也。
它应该在输出代码中显示两个值
如何解决此问题。
需要VB6代码帮助
在'如果-ElseIf',如果一个条件满足,则条件语句的其余部分不会被执行。如果你想得到两者,请尝试用if语句保留'chkcombin.Value = 1'的条件。 – Mahesh 2011-03-01 18:44:19
你的描述不是很清楚。例如,什么是“chkcombin1”?我建议您添加表单的屏幕截图以作进一步说明。 – Abbas 2011-03-01 18:46:23