I am using Windows application and created one form for Add and Edit mode. The issue is on Add it works fine, but on edit, controls are not displaying based on combobox selection. As per my combobox selection change event, I have hidden the controls. But my combobox is not selecting values and not triggering change event also. Code is :
//Edit Mode
public CompanyAddEdit(MainForm form, string id)
{
InitializeComponent();
passedForm = form;
var cmbList = BindCompanyType();
isEdit = true;
xmlDocPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Companies.xml");
xDocument = XDocument.Load(xmlDocPath);
Id = Convert.ToInt32(id);
XElement company = xDocument.Descendants("Company").FirstOrDefault(p => p.Element("Id").Value == Id.ToString());
if (company != null)
{
var type = company.Element("DataSourceType").Value;
cmbbx_companyType.SelectedItem = type;
}
}
I am binding Combobox using this method :
private Array BindCompanyType()
{
var companyTypeList = Enum.GetValues(typeof(CompanyType));
cmbbx_companyType.DataSource = companyTypeList;
return companyTypeList;
}
How can I fixed this? Any help will be appreciated.
