'search through items in a gridview without a database / sql

(ItemGridView.DataSource as DataTable).DefaultView.RowFilter = string.Format("OR Name like '{0}%'", searchBox.Text);

Trying search an item in my GridView by using the following line of code from How to search in Data gridview in C# Windows Form application? and got a System.NullReferenceException: 'Object reference not set to an instance of an object.'. Is there anything to solve this?

Very new to c# and need help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source