Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# listview filter contains

private void filterbox_TextChanged(object sender, EventArgs e)
{
    listView1.Items.Clear();   // clear all items we have atm
    if (filterbox.Text == "")
    {
        listView1.Items.AddRange(allItems.ToArray());  // no filter: add all items
        return;
    }
    // now we find all items that have a suitable text in any subitem/field/column
    var list = allItems.Cast<ListViewItem>()
                       .Where( x => x.SubItems
                                     .Cast<ListViewItem.ListViewSubItem>()
                                     .Any(y => y.Text.Contains(filterbox.Text)))
                       .ToArray();
    listView1.Items.AddRange(list);  // now we add the result
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: telerik mvc grid column with icon 
Csharp :: moq set delay to return 
Csharp :: how to make a block disappear in unity 
Csharp :: c# Remove String In C# 
Csharp :: display array elemetns to text box c# 
Csharp :: save position unity 
Csharp :: c# substring find word 
Csharp :: link form to a button in dashbord visual c# 
Csharp :: concatanate two lists in c# 
Csharp :: irrrtate throught an matrix c# 
Csharp :: c sharp system pause equivelent 
Csharp :: invalidoperationexception c# ui thread 
Csharp :: unity cannot click button 
Csharp :: asp.net c# get user email address from AD 
Csharp :: unity stop physics 
Csharp :: query associative table ef6 
Csharp :: c# convert string to array 
Csharp :: c# ip address to string 
Csharp :: write last line txt file c# 
Csharp :: c# decimal to fixed 2 
Csharp :: c# switch expression pattern matching 
Csharp :: select from list where not in other list c# 
Csharp :: Generic Stack 
Csharp :: c# for loops 
Csharp :: messagebox yes no c# 
Csharp :: wait c# 
Csharp :: datatable in c# 
Csharp :: lightbox 
Csharp :: wpf dispatcher timer is inaccurate 
Csharp :: IOException: Failed to prepare target build directory. Is a built game instance running? UnityEditor.WindowsStandalone.WindowsDesktopStandalonePostProcessor.DeleteDestination (UnityEditor.Modules.BuildPostProcessArgs args) 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =