private void listPlans_SelectedIndexChanged(object sender, System.EventArgs e) { textCarrier.Text = ""; textEmp.Text = ""; textPlanNum.Text = ""; if (listPlans.SelectedIndex >= 0) { textPlanNum.Text = list[listPlans.SelectedIndex * 2].ToString(); try{ Iap.ReadRecord(textPlanNum.Text); textCarrier.Text = Iap.ReadField(Iap.Carrier); textEmp.Text = Iap.ReadField(Iap.Employer); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); textCarrier.Text = ""; textEmp.Text = ""; textPlanNum.Text = ""; return; } finally{ Iap.CloseDatabase(); } } }
private void listEmployers_SelectedIndexChanged(object sender, System.EventArgs e) { if (listEmployers.SelectedIndex == -1) { textCarrier.Text = ""; } else { try{ Iap.ReadRecord((string)listEmployers.SelectedItem); } catch (ApplicationException ex) { Iap.CloseDatabase(); MessageBox.Show(ex.Message); textCarrier.Text = ""; textEmp.Text = ""; return; } textCarrier.Text = Iap.ReadField(Iap.Carrier); textEmp.Text = Iap.ReadField(Iap.Employer); Iap.CloseDatabase(); } }