private void buttonChangePartnerInfo_Click(object sender, EventArgs e) { if (listBoxCatteries.SelectedIndex != -1) { int selectedIndex = listBoxCatteries.SelectedIndex; FormCattery fc = new FormCattery("Изменение", FormCatInfoModes.ChangeInfo, catteries[listBoxCatteries.SelectedIndex]); fc.ShowDialog(); listBoxCatteries.SelectedIndex = selectedIndex; } }
private void buttonAddCatPartner_Click(object sender, EventArgs e) { if (listBoxPets.SelectedIndex != -1) { int selectedIndex = listBoxPets.SelectedIndex; FormCattery fc = new FormCattery("Новая запись", FormCatInfoModes.NewItem, cats[listBoxPets.SelectedIndex].Id); fc.ShowDialog(); listBoxPets.SelectedIndex = selectedIndex; } }