private void buttonModify_Click(object sender, EventArgs e) { int index = listBoxNumber.SelectedIndex; try { nc.modifyNumber(index, textBoxNumber.Text); listBoxNumber.DataSource = null; listBoxNumber.DataSource = nc.getNumbers(); } catch (ControllerException ce) { errorProviderAdd.SetError(buttonModify, ce.Message); } catch (Exception ex) { Debug.WriteLine(ex.Message); } if (listBoxNumber.Items.Count > 0) { felfedPaneleket(); } else { eltakarPaneleket(); } }