M
marcelo
Could you help me out here. I need to accomplish this:
I need to filter listbox items from by entering some characters to the
textbox. But the problem is that items (files that are read from directory)
in the listbox has the same name in the beginning, for example
'2007_<docNo>_<CustomerName_ItemSold>.doc'. And the information I need to
find is in the middle of a item name. How do I filter from anywhere (not
from the same beginning) in the item's name?
At the moment by entering some characters it selects items that were found
and here's the following code on textbox_textchange event:
listBox2.ClearSelected();
searchString2 = textBox2.Text;
listBox2.SelectionMode = SelectionMode.MultiExtended;
int x = -1;
if (searchString2.Length != 0)
{
do
{
x = listBox2.FindString(searchString2, x);
if (x != -1)
{
if (listBox2.SelectedIndices.Count > 0)
{
if (x == listBox2.SelectedIndices[0])
return;
}
listBox2.SetSelected(x, true);
}
}
while (x != -1);
}
I having trouble finding any example of this.
thanks a lot
P.S. hope I made myself clear
I need to filter listbox items from by entering some characters to the
textbox. But the problem is that items (files that are read from directory)
in the listbox has the same name in the beginning, for example
'2007_<docNo>_<CustomerName_ItemSold>.doc'. And the information I need to
find is in the middle of a item name. How do I filter from anywhere (not
from the same beginning) in the item's name?
At the moment by entering some characters it selects items that were found
and here's the following code on textbox_textchange event:
listBox2.ClearSelected();
searchString2 = textBox2.Text;
listBox2.SelectionMode = SelectionMode.MultiExtended;
int x = -1;
if (searchString2.Length != 0)
{
do
{
x = listBox2.FindString(searchString2, x);
if (x != -1)
{
if (listBox2.SelectedIndices.Count > 0)
{
if (x == listBox2.SelectedIndices[0])
return;
}
listBox2.SetSelected(x, true);
}
}
while (x != -1);
}
I having trouble finding any example of this.
thanks a lot
P.S. hope I made myself clear