I am using Combobox SelectedIndexChanged event to perform few tasks. It is working nice. But when i am closing the form, SelectedIndexChanged gets fired and i get "Object reference not set to an instance of an object." exception. My code is following-
private void cmbProductName_SelectedIndexChanged(object sender, EventArgs e)
Product p =(Product) cmbProductName.SelectedItem;
RawItems = RawItem.GetEntityList(p.Id, ConnectionString);
catch (Exception ex)
How to avoid the SelectedIndexChanged event being fired when form is closing?
anything your setting related to cmbProductName in Form Closing event? or may be focus will be there in Combo.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)