ListBox - what now???

G

Guest

hi

i try to find one specific entry in my listbox and i do get the 'not
supported method' error why? and how to find a entry in a listbox? i want to
key in "a" and i it should sort by "a" then i press "p" and now i wana see
all starting with "ap" like "apple". anyone knows whats with wrong with this
listboxes in cf?

cheers kune

in the help example i find this:
ListBox.FindString Method (String)

the Example tells me:
Private Sub FindMyString(ByVal searchString As String)
' Ensure we have a proper string to search for.
If searchString <> String.Empty Then
' Find the item in the list and store the index to the item.
Dim index As Integer = listBox1.FindString(searchString)
' Determine if a valid index is returned. Select the item if it is
valid.
If index <> -1 Then
listBox1.SetSelected(index, True)
Else
MessageBox.Show("The search string did not match any items in the
ListBox")
End If
End If
End Sub

and the platform says this:
..NET Framework
Supported in: 2.0, 1.1, 1.0

- - WHY SHOULD ID NOT B SUPPURTED THEN? DO I GET THAT WRONG? - -
 
P

Pete Vickers [MVP]

Hi,
it does not show in intellisense. How did it compile?

It is not supported in Compact Framework, full framework only.

This is a solution suggested by Alex Feinman

Sub textbox1_TextChanged(byval Sender as Object, ByVal e as EventArgs)
Handles textbox1.TextChanged
Dim i as Int32, item as Object
For I = 0 to listbox1.Items.Count - 1
Set item = listbox1.Items.Item(I)
if item.ToString().StartsWith(Textbox1.Text) then
listBox1.SelectedIndex = i
Exit For
end if
Next I
End Sub


Pete
 
G

Guest

hi pete

thank you. i did not think it would not be supported i am sorry my wrong!!!
thank you for the solution.

cheers kune
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top