Esempio n. 1
0
        private void regionDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridView  thisGrid          = (DataGridView)sender;
            BindingSource thisBindingSource = (BindingSource)thisGrid.DataSource;
            DataRow       ThisDataRow       = ((DataRowView)thisBindingSource.Current).Row;

            //DataTable table = (DataTable)thisGrid.DataSource;
            //DataRow ThisDataRow = table.Rows[thisGrid.CurrentCell.RowIndex];

            //Convert the current selected row in the DataGridView to a DataRow
            //DataRowView ThisDataRow = (DataRowView)regionDataGridView.CurrentRow.DataBoundItem;
            //mainDataRow = employee.Select("PLU='" + currentDataRowView[0].ToString() + "'"); //get the primary key id

            //BindingSource thisBindingSource = (BindingSource)sender;
            //DataRow ThisDataRow = ((DataRowView)thisBindingSource.Current).Row;
            if (null != ThisDataRow)
            {
                using (var f = new RowDetails {
                    dataRow = ThisDataRow, Owner = this
                })
                {
                    Program._serialPort.DataReceived -= new SerialDataReceivedEventHandler(DataReceivedHandler);
                    f.ShowDialog();
                }

                //form2 = new RowDetails(ThisDataRow);
                //form2.ShowDialog();

                //form2.ShowDataGridViewRow(ThisDataRow);
            }
            //do whatever you do in double click
        }