Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok so i know you can do it nut how?:

 

a drop down box that you can enter data into to search and enter your own data.

 

http://www.faceparty.com/public/588/images/mrbirchy_3746115.jpg

 

please say someone can help.

  • *Experts*
Posted
To do the searching bit, you need to code it yourself. Here's a bit of code I wrote to do it (just put this in your keypress event of the combo):
If Not (e.KeyChar = ControlChars.Back) And _
   Not (e.KeyChar = ControlChars.Tab) And _
     (cbo.Text.Length > 0) Then

           Dim itemIndex As Integer = -1
           Dim i As New String
           Dim index As Integer = 0

           For Each i In cbo.Items
               If i.ToUpper.StartsWith(cbo.Text.ToUpper) Then
                   itemIndex = index
                   Exit For
               End If
               index += 1
           Next

           If itemIndex > -1 Then
               Dim oldText As String = cbo.Text
               cbo.Text &= cbo.Items(itemIndex).Substring(cbo.Text.Length)
               cbo.SelectionStart = oldText.Length
               cbo.SelectionLength = cbo.Text.Length - oldText.Length
           End If
       End If

You'll obviously need to modify cbo to fit the name of your combo.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...