コード例 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                try {
                    if (senderGrid.Columns[e.ColumnIndex].Name == "dtgSee")
                    {
                        var x = new userProject(int.Parse(dataGridView1.Rows[e.RowIndex].Cells["dtgId"].Value.ToString()));
                        x.Show();
                    }
                    else if (senderGrid.Columns[e.ColumnIndex].Name == "dtgDelete")
                    {
                        var x = new deleteProject(dataGridView1.Rows[e.RowIndex].Cells["dtgName"].Value.ToString());
                        x.Show();
                    }
                    else if (senderGrid.Columns[e.ColumnIndex].Name == "dtgModify")
                    {
                        var x = new editProject(dataGridView1.Rows[e.RowIndex].Cells["dtgName"].Value.ToString());
                        x.Show();
                    }
                } catch (Exception ex) {
                }
            }
        }
コード例 #2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try {
         var f = new deleteProject(this.name);
         f.Show();
     } catch (Exception ex) { }
 }