excel: drop dpwn boxes problem!!

Originally posted by birchy
yeah but you cant edit the text with a combo box.

Of course you can... Its all in the code:)
Edit The Properties, If Its not there then there definately is code.
 
To do the searching bit, you need to code it yourself. Heres a bit of code I wrote to do it (just put this in your keypress event of the combo):
Code:
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
Youll obviously need to modify cbo to fit the name of your combo.
 
Back
Top