Re: specifying selected item in a listbox

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Herfried K. Wagner [MVP] (hirf-spam-me-here_at_gmx.at)
Date: 02/26/04


Date: 26 Feb 2004 22:45:36 +0100

Cor,

* "Cor" <non@non.com> scripsit:
>> Dim i As Integer = Me.ListBox1.FindString(Me.TextBox1.Text)
>> If i = ListBox.NoMatches Then
>> Me.ListBox1.SelectedIndex = -1
>> Else
>> Me.ListBox1.SelectedIndex = i
>> End If
>> End Sub
>> ///
>
> This is kicking,
>
> Some (maybe what longer) time ago I got every time a messages from
> Herfried.
>
> "Better is findstringexact"
>
> But very much "better" is
>
> \\\
> me.listbox1.SelectedIndex = Me.ListBox1.FindStringexact(Me.TextBox1.Text)
> ///
>
> I would not have written this if I had not seen that findstringexact

I used 'FindString' because it allows to search for parts of the string.

If there are items...

Cor
Corina
Corinna
Corrina
Corrinna

... typing "Corr" into the textbox will select "Corrina".

-- 
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet/>


Relevant Pages

  • Re: Holes in the back of my radio
    ... > Hmm a RangeRover with the sound of transit side kicking? ... the motorway I need a decent stereo system in order to hear quiet passages ... presence on the motorway for the occupants of the Rangey. ... just because I have a sub doesn't mean the rest of the world has ...
    (uk.rec.cars.misc)
  • Re: Installed ToM Pinball Pro sound kit, what am I missing?
    ... LTG:) ... balance, but the sub isn't really kicking and everything sounds really ...
    (rec.games.pinball)
  • Re: test
    ... its not quiet we are alive and kicking:) ... Laurent Demaret wrote: ... sub 1024g/F8F019DF 2003-11-21 ... To unsubscribe, ...
    (freebsd-newbies)