VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



To find item from list box (Like Font Dialog Box)

by manish saraf (dhule India) (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 8th July 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

To find item from list box (Like Font Dialog Box)

Rate To find item from list box (Like Font Dialog Box)



'Place a List box on form
'Apply the following code
'

Private Sub Form_Load()
a = 1
While (a <= 12)
List1.AddItem Mid(Format("1/" & a & "/2002", "dd-Mmm-yy"), 4, 3)
a = a + 1
Wend
End Sub

Private Sub Text1_Change()
On Error GoTo err
If (Text1.Text = "") Then
List1.Selected(a) = False
GoTo err
End If

a = List1.ListCount
While (a >= 0)
 If (Text1.Text = Left(List1.List(a), Len(Text1.Text))) Then
  List1.Selected(a) = True
 End If
a = a - 1
Wend

err:
Resume Next
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii = 13) Then
'It will display full name in text box
Text1.Text = List1.Text
End If
End Sub


Download this snippet    Add to My Saved Code

To find item from list box (Like Font Dialog Box) Comments

No comments have been posted about To find item from list box (Like Font Dialog Box). Why not be the first to post a comment about To find item from list box (Like Font Dialog Box).

Post your comment

Subject:
Message:
0/1000 characters