using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // TODO: данная строка кода позволяет загрузить данные в таблицу "kalachyovaISP41DataSet.clients". При необходимости она может быть перемещена или удалена. this.clientsTableAdapter.Fill(this.kalachyovaISP41DataSet.clients); } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } private void button1_Click(object sender, EventArgs e) { clientsBindingSource.AddNew(); //Добавить } private void button2_Click(object sender, EventArgs e) { if (MessageBox.Show($"Вы точно хотите удалить выбранную запись?", "Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { clientsBindingSource.RemoveCurrent(); MessageBox.Show("Запись удалена."); clientsTableAdapter.Update(kalachyovaISP41DataSet.clients); // dmshDataSet - название с маленькой. } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } clientsBindingSource.RemoveCurrent(); } private void button3_Click(object sender, EventArgs e) { clientsBindingSource.EndEdit(); } private void button4_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); form2.Show(); } } }