private void dgvTovar_CellContentClick(object sender, DataGridViewCellEventArgs e) { var dgv = sender as DataGridView; if (dgv.Columns[e.ColumnIndex] is DataGridViewButtonColumn) { DataRow[] dr = DBclass.DS.user.Select("IDUser = "******"IDUser"].Value.ToString()); if (dgv.Columns[e.ColumnIndex].Name == "colBtn") { DataSetTpos.userRow uRow = (DataSetTpos.userRow)dr[0]; AddUser adU = new AddUser(uRow); adU.ShowDialog(); } else if (dgv.Columns[e.ColumnIndex].Name == "colBtnDel") { if (MessageBox.Show("Удалить пользователя?", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { dr[0].Delete(); this.userTableAdapter1.Update(DBclass.DS.user); this.userTableAdapter1.Fill(DBclass.DS.user); } } } }
private void btnAdd_Click(object sender, EventArgs e) { AddUser adU = new AddUser(); adU.ShowDialog(); }