private void btnDelete_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { return; } string selectedUserId = dataGridView1.SelectedRows[0].Cells["useridDataGridViewTextBoxColumn"].Value.ToString(); SampleTableAdapterDataSet.usersRow selectedUser = sampleTableAdapterDataSet1.users.Where(x => x.user_id == selectedUserId).SingleOrDefault(); frmUserDetail frm = new frmUserDetail(SharedCommon.ActionType.Delete, selectedUser); frm.ShowDialog(); usersTableAdapter1.Fill(sampleTableAdapterDataSet1.users); }
public frmUserDetail(SharedCommon.ActionType actionType, SampleTableAdapterDataSet.usersRow selectedUser) { InitializeComponent(); this._actionType = actionType; this._selectedUser = selectedUser; }