2016-04-25 116 views
0

vb.net 2012其作品完美 但现在IAM试图在VB6Visual Basic 6的组合框获得selectedItem属性值

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 

工作如何将selectedItem对VB6?

+0

IAM试图让在组合框中 我的意思是我想知道所选择的项目是什么项目被选中 –

回答

1

使用本:

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

If ComboBox1.Text = "one" Then 
+0

完美工作,在此先感谢 –

1

请这个尝试 -

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