Click here to Skip to main content
15,898,980 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi my combobox items
raj
abi
kumar
ani
kamal
kannan


when i type the combobox in "K" then first the combobox display kannan next displaying item is
kamal..... in this type to display to be changed, pls help me...
Posted

It's called "Auto suggest", and google has a lot of info on it: vb.net auto suggest textbox[^]
 
Share this answer
 
I solve this My code below::::


VB
Private Sub ComboBox2_KeyUp(sender As Object, e As KeyEventArgs) Handles ComboBox2.KeyUp
       Dim sTypedText As String
       Dim iFoundIndex As Integer
       Dim oFoundItem As Object
       Dim sFoundText As String

       Select Case e.KeyCode
           Case Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Delete, Keys.Down
               Return
       End Select

       sTypedText = ComboBox2.Text
       iFoundIndex = ComboBox2.FindString(sTypedText)
       If iFoundIndex >= 0 Then
           oFoundItem = ComboBox2.Items(iFoundIndex)
           sFoundText = ComboBox2.GetItemText(oFoundItem)
           'ComboBox1.SelectedIndex = iFoundIndex
           'sAppendText = sFoundText.Substring(sTypedText.Length)
           'ComboBox1.Text = sTypedText & sAppendText
           'ComboBox1.SelectionStart = sTypedText.Length
           'ComboBox1.SelectionLength = sAppendText.Length
       End If
   End Sub




now go to combobox2 properies window and change the Auto complete mode SuggestAppend and Auto complete sours ListItems



that's all the code is runing:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900