Visual C# Express with SQL 2005 Express
I am creating a data aware application but I have ran into what feels like a 'hack' to me.
I have a form with a ComboBox which is databound to a database. The selectedValue field is mapped to a integer field in the db. So inside the SelectedIndexChanged Event when I do the following I get a null reference exception when the app closes:
int idvalue = cmbbox.selectedValue
I notice if I add the following I no longer get an exception:
if (cmbbox.selectedValue != null)
idValue = cmbbox.selectedValue
Does this feel like a hack or is just me??? Why does selectedIndexChanged event get fired when the app closes??