private void buttonEdit_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows != null) { int _countryID = (int)dataGridView1.SelectedRows[0].Cells[0].Value; CountriesEditForm newForm = new CountriesEditForm(); foreach (Country cInfo in cList) { if (cInfo.CountryID == _countryID) { cInfo.GetCountry(_countryID); newForm.сountry = cInfo; if (newForm.ShowDialog() == DialogResult.OK) { newForm.сountry.UpdateCountry(); } } } RefreshItems(); } else { MessageBox.Show("Елемнти відсутні або не вибрані", "Елемент не вибраний", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void buttonAdd_Click(object sender, EventArgs e) { CountriesEditForm newForm = new CountriesEditForm(); if (newForm.ShowDialog() == DialogResult.OK) { newForm.сountry.InsertNewCountry(); } RefreshItems(); }