示例#1
0
 private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         this.dataGridView1.CurrentRow.Selected = true;
         e.Handled = true;
         DataGridViewRow row = this.dataGridView1.SelectedRows[0];
         mainmenu.idcustomer = row.Cells["ID"].Value.ToString();
         selected selecte = new selected();
         selecte.ShowDialog();
     }
 }
示例#2
0
        /*private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
         * {
         *  DataGridView dgv = sender as DataGridView;
         *  if (dgv == null)
         *      return;
         *  if (dgv.CurrentRow.Selected)
         *  {
         *      DataGridViewRow row = this.dataGridView1.SelectedRows[0];
         *      mainmenu.idcustomer = row.Cells["ID"].Value.ToString();
         *      selected selecte = new selected();
         *      selecte.ShowDialog();
         *  }
         * }*/

        private void dataGridView1_CellMouseDoubleClick(Object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            if (dgv == null)
            {
                return;
            }
            if (dgv.CurrentRow.Selected)
            {
                DataGridViewRow row = this.dataGridView1.SelectedRows[0];
                mainmenu.idcustomer = row.Cells["ID"].Value.ToString();
                selected selecte = new selected();
                selecte.ShowDialog();
            }
        }