1. Create a standard exe project.
2. Place a label with caption "Enter Text to Display in Combo box from its list:
3. Place a Textbox under than label.
4. Under Textbox place a comand button with caption "Show Text"
5. Place a Combo Box Under that Button and set its style property to 2
6. In list Property of combo box specify following items:-
Text1
Text2
Text3
Text4
Text5
Now add code to the click evevnt of command button.
Private Sub Command1_Click()
On Error GoTo nferr
Combo1.ListIndex = -1
Do While Not Combo1.ListIndex = Combo1.ListCount
If Combo1.Text = Text1.Text Then
Exit Do
Combo1.ListIndex = Combo1.ListIndex + 1
End If
Loop
nferr:
If Err.Number <> 0 Then
MsgBox "Text specified not found in the list", vbExclamation
Text1.Text = ""
Combo1.ListIndex = -1
End If
End Sub
Comments