I have created a Windows form in which I have taken a drop down combo box and certain fields. The value of the fields changes accordingly when any value is selected from the drop down. The problem I am facing is that I cannot click anywhere else in the windows form. The focus stays on with the ComboBox drop down. I have used other button like 'PRINT' which provides the facility of printing the information displayed in the win form. but I cannot click on it because of the focus that Is stuck onto the combo box. For the combo box, I have used the following Code:
private void btnPrint_Click(object sender, EventArgs e)
{
try
{
ExistingAccountScreen existingAcctScreen = new ExistingAccountScreen();
FillExistingAppForPrinting(existingAcctScreen);
using (PrintViewer pv=new PrintViewer(existingAcctScreen))
{
pv.ShowDialog();
}
}
catch (Exception ex)
{
AOTHelper.WriteLog(ex);
}
}
The drop down click event is as below which is creating a problem while selecting value other than the defult selected value
private void cmbAccountNumber_SelectedIndexChanged(object sender, EventArgs e)
{
ExistingAccountInfo acctInfo = cmbAccountNumber.SelectedItem as ExistingAccountInfo;
if (acctInfo == null)
return;
existingAccountInfoBindingSource.DataSource = ExistingAccountInfo.Get(acctInfo.AccountNumber);
accountStatusBindingSource.DataSource = ExistingAccountInfo.GetExistingStatusCodes(acctInfo.AccountNumber);
}