コード例 #1
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");
     }
 }