Click here to Skip to main content
16,015,504 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Timer Pin
Mitch F.15-Jun-05 8:44
Mitch F.15-Jun-05 8:44 
GeneralServices Pin
pittuck15-Jun-05 7:29
pittuck15-Jun-05 7:29 
GeneralRe: Services Pin
KaptinKrunch15-Jun-05 19:45
KaptinKrunch15-Jun-05 19:45 
GeneralRe: Services Pin
pittuck15-Jun-05 20:55
pittuck15-Jun-05 20:55 
GeneralRe: Services Pin
KaptinKrunch16-Jun-05 5:12
KaptinKrunch16-Jun-05 5:12 
Generalsql2000 / image / ado Pin
erikkl200015-Jun-05 6:58
erikkl200015-Jun-05 6:58 
GeneralRe: sql2000 / image / ado Pin
Dave Kreskowiak15-Jun-05 7:31
mveDave Kreskowiak15-Jun-05 7:31 
GeneralAuto Complete Combobox problems... Pin
jake07215-Jun-05 5:18
jake07215-Jun-05 5:18 
I am trying to create an autocomplete combobox that can be readonly. My problem is with my autocomplete handler, not properly selecting the text. If I type slow, I have no problems, however, if I type fast, the selection does not work correctly; the "auto-completed" text is not selected properly. Please Help!

Autocomplete code:

<br />
    Private Sub CompletionCombo_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp<br />
        Dim sTypedText As String<br />
        Dim iFoundIndex As Integer<br />
        Dim oFoundItem As Object<br />
        Dim sFoundText As String<br />
        Dim sAppendText As String<br />
<br />
        If Me.Items.Count > 0 Then<br />
            'Allow select keys without Autocompleting<br />
            Select Case e.KeyCode<br />
                Case Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Delete, Keys.Down, Keys.ControlKey, Keys.ShiftKey, Keys.Alt, Keys.ShiftKey, Keys.MButton, Keys.LButton, Keys.RButton, Keys.Home, Keys.End<br />
                    'e.Handled = False<br />
                    Exit Sub<br />
            End Select<br />
<br />
            'Get the Typed Text and Find it in the list<br />
            If Me.Text.Length > 0 And Me.Text.Length <> Me.SelectedText.Length Then<br />
                sTypedText = Me.Text<br />
                iFoundIndex = Me.FindString(sTypedText)<br />
<br />
                'If we found the Typed Text in the list then Autocomplete<br />
                If iFoundIndex >= 0 Then<br />
                    'Get the Item from the list (Return Type depends if Datasource was bound <br />
                    ' or List Created)<br />
                    oFoundItem = Me.Items(iFoundIndex)<br />
<br />
                    'Use the ListControl.GetItemText to resolve the Name in case the Combo <br />
                    ' was Data bound<br />
                    sFoundText = Me.GetItemText(oFoundItem)<br />
<br />
                    'Append then found text to the typed text to preserve case<br />
                    sAppendText = sFoundText.Substring(sTypedText.Length)<br />
                    Me.Text = sTypedText & sAppendText<br />
<br />
                    'Select the Appended Text<br />
                    Me.SelectionStart = sTypedText.Length<br />
                    Me.SelectionLength = sAppendText.Length<br />
                    'Me.SelectedIndex = iFoundIndex<br />
                End If<br />
            End If<br />
        End If<br />
    End Sub<br />
<br />
    Private Sub CompletionCombo_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Leave<br />
        Dim iFoundIndex As Integer<br />
<br />
        If Me.Items.Count > 0 Then<br />
            Dim sFoundText As String = ""<br />
            If Me.SelectedText.Length <> Me.Text.Length Then<br />
                sFoundText = Me.Text.Substring(Me.SelectedText.Length, Me.Text.Length - Me.SelectedText.Length)<br />
            End If<br />
            If sFoundText.Length > 0 Then<br />
                iFoundIndex = Me.FindString(Me.Text)<br />
<br />
                Me.SelectedIndex = iFoundIndex<br />
            End If<br />
        End If<br />
<br />
    End Sub<br />


Thanks,

Jake
GeneralRe: Auto Complete Combobox problems... Pin
LordLothar15-Jun-05 6:20
LordLothar15-Jun-05 6:20 
GeneralSilly Question - Handling a single quote while writing a query in vb.net Pin
prathiba_naresh15-Jun-05 5:00
prathiba_naresh15-Jun-05 5:00 
GeneralRe: Silly Question - Handling a single quote while writing a query in vb.net Pin
Dave Kreskowiak15-Jun-05 7:27
mveDave Kreskowiak15-Jun-05 7:27 
GeneralRe: Silly Question - Handling a single quote while writing a query in vb.net Pin
Mitch F.15-Jun-05 13:59
Mitch F.15-Jun-05 13:59 
GeneralRe: Silly Question - Handling a single quote while writing a query in vb.net Pin
prathiba_naresh22-Jun-05 5:23
prathiba_naresh22-Jun-05 5:23 
GeneralFilelistbox Pin
JimClark6815-Jun-05 4:17
JimClark6815-Jun-05 4:17 
GeneralRe: Filelistbox Pin
Dave Kreskowiak15-Jun-05 4:22
mveDave Kreskowiak15-Jun-05 4:22 
GeneralRe: Filelistbox Pin
JimClark6815-Jun-05 5:29
JimClark6815-Jun-05 5:29 
GeneralRe: Filelistbox Pin
Dave Kreskowiak15-Jun-05 7:18
mveDave Kreskowiak15-Jun-05 7:18 
Generaldatagrid problem Pin
nickc115-Jun-05 2:50
sussnickc115-Jun-05 2:50 
Generalpopulate dropdownlist Pin
Manik Nath14-Jun-05 22:45
Manik Nath14-Jun-05 22:45 
GeneralRe: populate dropdownlist Pin
syed saba14-Jun-05 23:40
syed saba14-Jun-05 23:40 
GeneralRe: populate dropdownlist Pin
CalaLily15-Jun-05 3:47
CalaLily15-Jun-05 3:47 
GeneralRe: populate dropdownlist Pin
15-Jun-05 19:34
suss15-Jun-05 19:34 
GeneralProblem with Dhtmledit control Pin
Anonymous14-Jun-05 21:48
Anonymous14-Jun-05 21:48 
GeneralRe: Problem with Dhtmledit control Pin
Dave Kreskowiak15-Jun-05 3:49
mveDave Kreskowiak15-Jun-05 3:49 
QuestionDhtmledit syntax ? Pin
Anonymous14-Jun-05 21:11
Anonymous14-Jun-05 21:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.