private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name == "delcol") { int id = Convert.ToInt32(((List <News>)dataGridView1.DataSource)[e.RowIndex].PostID); DataAccess.NewsDAO.DeletePost(id); Project.Files.WriteFile("Delete Post " + id + " "); LoadData(); } if (dataGridView1.Columns[e.ColumnIndex].Name == "editcol") { int id = Convert.ToInt32(((List <News>)dataGridView1.DataSource)[e.RowIndex].PostID); FormAddNews f = new FormAddNews(((List <News>)dataGridView1.DataSource)[e.RowIndex], id, WriterID); f.visibleUpdate(); f.Show(); } }
private void button1_Click(object sender, EventArgs e) { FormAddNews frm = new FormAddNews(WriterID); frm.Show(); }