Пример #1
0
 private void dataGridView3_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int postid = Convert.ToInt32(dataGridView3.Rows[e.RowIndex].Cells["postid"].Value);
         if (dataGridView3.Columns[e.ColumnIndex].Name == "Content")
         {
             ContentPost form1 = new ContentPost(GameNews.Logic.PostList.getPostContentAndImageByPostID(postid),
                                                 dataGridView3.Rows[e.RowIndex].Cells["title"].Value.ToString());
             form1.Show();
         }
         if (dataGridView3.Columns[e.ColumnIndex].Name == "delete")
         {
             DialogResult dialogResult = MessageBox.Show("Do u want remove this post from the list", "Confirm ", MessageBoxButtons.YesNo);
             if (dialogResult == DialogResult.Yes)
             {
                 GameNews.Logic.Post.deletePostByID(postid);
                 loadData();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Something went wrong");
     }
 }
Пример #2
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex >= 0)
         {
             int postid = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["postid"].Value);
             if (dataGridView1.Columns[e.ColumnIndex].Name == "Content")
             {
                 ContentPost form1 = new ContentPost(GameNews.Logic.PostList.getPostContentAndImageByPostID(postid),
                                                     dataGridView1.Rows[e.RowIndex].Cells["title"].Value.ToString());
                 form1.Show();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Something went wrong");
     }
 }