Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27512

VS 2012 Filter through combobox

$
0
0
Hi,

I have managed to filter my combobox so it filters and displays the correct records ie when A is typed all A records show, B is typed all B records show and so on. However it would it be possible to have a message box to display when no records is found in the combobox?

The coding i have so far is :-

Code:

  Private Sub cmblogged_KeyPress(sender As Object, e As KeyPressEventArgs) Handles cmblogged.KeyPress
        If Char.IsControl(e.KeyChar) Then Return

        With Me.cmblogged

            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

            .SelectedIndex = Index
            .SelectionStart = ToFind.Length
            .SelectionLength = .Text.Length - .SelectionStart

            e.Handled = True

        End With

    End Sub


Viewing all articles
Browse latest Browse all 27512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>