ComboBox

jutiyi

Member
Joined
Feb 16, 2005
Messages
14
Programming Experience
1-3
The attached below is my autoCompleteComboBox sample.

But i dun't know how to show the comboBox item as text below
the ComboBox after i selected it?

Can anyone how me to solve it.

Thanks a lot.
 

Attachments

malitice

Active member
Joined
Feb 20, 2005
Messages
41
Programming Experience
1-3
Here is the drop-down combo box code I use:

VB.NET:
 Private Sub combobox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles combobox1.KeyPress 
 
        If Char.IsControl(e.KeyChar) Then Return 
 
        With Me.combobox1 
 
            Dim ToFind As String = .Text.Substring(0, .SelectionStart) & e.KeyChar 
            Dim Index As Integer = .FindStringExact(ToFind) 
            If Index = -1 Then Index = .FindString(ToFind) 
            If Index = -1 Then Return 
 
 
 
            If .DropDownStyle = ComboBoxStyle.DropDown Then 
                .DroppedDown = True 
            End If 
 
            .SelectedIndex = Index 
            .SelectionStart = ToFind.Length 
            .SelectionLength = .Text.Length - .SelectionStart 
 
            e.Handled = True 
 
        End With 
    End Sub
 
Top Bottom