コード例 #1
0
        private void dbGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SqlConnection con = new SqlConnection(ConnectionString);

            con.Open();

            if (e.ColumnIndex == dbGrid1.Columns["del"].Index)
            {
                int        row = e.RowIndex;
                int        sel = Convert.ToInt32(dbGrid1.Rows[row].Cells["Id"].Value);
                SqlCommand exe = new SqlCommand("DELETE FROM AssessmentComponent WHERE Id = '" + sel + "'", con);
                exe.ExecuteNonQuery();
                MessageBox.Show("Deleted!");

                Form20 form = new Form20();
                this.Hide();
                form.Show();
            }
            if (e.ColumnIndex == dbGrid1.Columns["btnEdit"].Index)
            {
                int row = e.RowIndex;
                int sel = Convert.ToInt32(dbGrid1.Rows[row].Cells["Id"].Value);

                this.Hide();
                Form23 form = new Form23(sel);
                form.Show();
            }
        }
コード例 #2
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Form20 form = new Form20();

            this.Hide();


            form.Show();
        }