private void btnEdit_Click(object sender, System.EventArgs e) { if (dataGridView1.SelectedCells.Count > 0) { var index = dataGridView1.SelectedCells[0].RowIndex; var post = dataGridView1.Rows[index].DataBoundItem as PostDataGrid; FrmEditPost frm = new FrmEditPost(post.Id); frm.Show(); } }
private void btnAdd_Click(object sender, System.EventArgs e) { if (dataGridView1.SelectedCells.Count > 0) { var index = dataGridView1.SelectedCells[0].RowIndex; var post = dataGridView1.Rows[index].DataBoundItem as PostDataGrid; FrmEditPost frm = new FrmEditPost(null); frm.FormClosing += editFrm_FormClosing; frm.Show(); } }
private void btnAccept_Click(object sender, EventArgs e) { if (TopicsGridView.SelectedCells.Count > 0) { var index = TopicsGridView.SelectedCells[0].RowIndex; var suggestedTopic = TopicsGridView.Rows[index].DataBoundItem as TopicDataGrid; FrmEditPost frm = new FrmEditPost(null) { Owner = this }; frm.SuggestedTopicId = suggestedTopic.Id; frm.FormClosing += editFrm_FormClosing; frm.Show(); } }