private void buttonAccessShow_Click(object sender, EventArgs e) { if (!(listBoxAccess.SelectedItem is Access access)) { return; } var accessNewForm = new FormAccessNew(access); accessNewForm.ShowDialog(); LoadAccess(); }
private void buttonAccessAdd_Click(object sender, EventArgs e) { try { Access theAccess = new Access(); theAccess.Save(); theAccess.Name = "Выборка № " + theAccess.ID.ToString("000000"); theAccess.Update(); FormAccessNew theFormAccessNew = new FormAccessNew(theAccess); theFormAccessNew.ShowDialog(); this.LoadAccess(); } catch (Exception ex) { listBoxAccess.DataSource = null; listBoxAccess.Items.Add(ex.Message); } }