Beispiel #1
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                DataGridViewSelectedRowCollection row = dataGridView1.SelectedRows;
                string id = row[0].Cells["id"].Value.ToString();

                ViewRecipeWindow viewRecipeWindow = new ViewRecipeWindow(Int32.Parse(id));
                viewRecipeWindow.ShowDialog();
            }
        }
Beispiel #2
0
        private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                DataGridViewSelectedRowCollection row = dataGridView1.SelectedRows;
                if (row.Count > 0)
                {
                    if (dataGridView1.CurrentCell.RowIndex >= 0 && dataGridView1.CurrentCell.RowIndex < dataGridView1.Rows.Count)
                    {
                        string id = row[0].Cells["id"].Value.ToString();

                        ViewRecipeWindow viewRecipeWindow = new ViewRecipeWindow(Int32.Parse(id));
                        viewRecipeWindow.ShowDialog();
                    }
                }
            }
        }