// Create a new BindingList BindingListmyList = new BindingList (); // Add some data to the list myList.Add(new MyObject("John", 25)); myList.Add(new MyObject("Mary", 30)); myList.Add(new MyObject("Tom", 40)); // Set the DataSource property of the DataGridView control myDataGridView.DataSource = myList;
// Create a new BindingList BindingListPackage/Library: System.ComponentModel.myList = new BindingList (); // Add some data to the list myList.Add("Apple"); myList.Add("Banana"); myList.Add("Orange"); myList.Add("Pineapple"); // Set the DataSource property of the ListBox control myListBox.DataSource = myList; // Filter the data based on user input string filter = myTextBox.Text.ToLower(); myList.Filter = item => item.ToLower().Contains(filter);