Exemple #1
0
        private void searchNoteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
            NoteSearch frmNoteSearch = new NoteSearch();

            frmNoteSearch.Show();
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string id      = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
            string command = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();

            if (command.ToLower() == "delete")
            {
                if (MessageBox.Show("Are you sure to Delete", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    string       deletequery = "delete from tblNote where note_id=" + id;;
                    DBConnection db          = new DBConnection();
                    db.executyQuery(deletequery);
                    MessageBox.Show(" Note Successfully Deleted");
                    this.Close();
                    NoteSearch frmNoteSearch = new NoteSearch();
                    frmNoteSearch.Show();
                }
            }
        }