Esempio n. 1
0
        private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            //if (e.KeyCode == Keys.Up)
            //{
            //    if (dataGridView1.Rows.Count > 0)
            //    {
            //        if (dataGridView1.CurrentCell != null & dataGridView1.CurrentCell.RowIndex >= 0)
            //        {
            //            var index = dataGridView1.CurrentCell.RowIndex;
            //            index = Math.Max(index - 1, 0);

            //            dataGridView1.ClearSelection();
            //            dataGridView1.CurrentCell = dataGridView1[1, index];
            //            dataGridView1.Rows[index].Selected = true;
            //        }
            //    }
            //}
            if (e.KeyCode == Keys.Enter)
            {
                if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.RowIndex >= 0)
                {
                    KB.DAL.DBHelper db  = new KB.DAL.DBHelper();
                    DATA0555BLL     bll = new DATA0555BLL(db);

                    Data0555          = bll.getDATA0555ByRKEY(decimal.Parse(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString()));
                    this.DialogResult = DialogResult.OK;
                }
            }
        }
Esempio n. 2
0
        private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (dataGridView1.CurrentCell != null && e.RowIndex >= 0)
            {
                KB.DAL.DBHelper db  = new KB.DAL.DBHelper();
                DATA0555BLL     bll = new DATA0555BLL(db);

                Data0555          = bll.getDATA0555ByRKEY(decimal.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                this.DialogResult = DialogResult.OK;
            }
        }