Windows Form Application, C#, in VS2010 Express.
I get the "Object reference not set to an instance of an object." error with the line of code below, when I attempt to close the Form.
Int32 myID = Convert.ToInt32(((DataRowView)projectBindingSource.Current).Row.ItemArray[0]);
This is a simple form with two data-bound controls. The record has three fields, and I'm attempting to grab the non-bound field. The code runs fine, except for the error when I close the form.
That line of code is in a comboBox1_SelectedIndexChanged event handler, so not sure why the error fires on form close. Any suggestions?