Search through datagridview not working - System.NullReferenceException error
问题 I am trying to run a search through column 2 (data type: number) on my datagridview but keep getting the following error message: An unhandled exception of type 'System.NullReferenceException' occurred in SpeedyRent.exe Additional information: Object reference not set to an instance of an object. The error is being thrown at if (!string.Equals(row.Cells[1].Value.ToString(), driverNo.Text, StringComparison.OrdinalIgnoreCase)) What is it that I'm doing wrong? I've included my code below: void