visual basic 6 combobox获得selecteditem值

时间:2016-04-25 20:53:37

标签: combobox vb6

vb.net 2012它的作品非常完美 但现在我试图在vb6工作

Private Sub showSelectedButton_Click_1(sender As Object, e As EventArgs) Handles btn1.Click 
If ComboBox1.SelectedItem = "one" Then
        MsgBox("ok")
    ElseIf ComboBox1.SelectedItem = "tow" Then
        MsgBox("no")
    End If
End Sub

如何在VB6上选择项目?

2 个答案:

答案 0 :(得分:2)

使用它:

If ComboBox1.List(ComboBox1.ListIndex) = "one" Then

If ComboBox1.Text = "one" Then

答案 1 :(得分:1)

请试试这个 -

Private Sub showSelectedButton_Click() 
    If ComboBox1.Text= "one" Then
        MsgBox("ok")
    ElseIf ComboBox1.Text= "tow" Then
        MsgBox("no")
    End If
End Sub
相关问题