Help with a datagrid
-
The following code works well, when I tab trought the emptyDataGrid the cells are in edit mode but when the form shows up, the emptyDataGrid seems to be focused because if I tab I fall in the second cell of the grid but if I just type it doesn't put the keystrokes in the first cell, it is like the first cell is not in edit mode. Tried multiple things but nothing works. Not sure what to do. The result that should be obtained is as soon as the form shows up, at the first keystroke the first cell of emptyDataGrid should be in edit mode and registering keystrokes of course. Thanks for any help. (Writing a good finder is definitely the worst thing I never tackled in programming) public void SetFinder(ref ComplexObject finderObject) { finderObject.Read(); complexObject = finderObject; dataGrid = finderObject.FinderDatagrid; dataGrid.ColumnHeadersVisible = false; datagridSplit.Panel2.Controls.Add(dataGrid); foreach (DataColumn column in finderObject.Tables[0].Columns) { if (column.ColumnMapping == MappingType.Element) { emptyTable.Columns.Add(new DataColumn(column.ColumnName, column.DataType)); } } emptyTable.Rows.Add(emptyTable.NewRow()); emptyTable.AcceptChanges(); emptyDataGrid.DataSource = emptyTable; emptyDataGrid.AllowUserToAddRows = false; emptyDataGrid.AllowUserToResizeRows = false; emptyDataGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; emptyDataGrid.Dock = DockStyle.Fill; emptyDataGrid.RowHeadersVisible = false; emptyDataGrid.ScrollBars = ScrollBars.None; datagridSplit.Panel1.Controls.Add(emptyDataGrid); datagridSplit.SplitterDistance = emptyDataGrid.PreferredSize.Height + 5; emptyDataGrid.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(emptyDataGrid_EditingControlShowing); emptyDataGrid.CellLeave += new DataGridViewCellEventHandler(emptyDataGrid_CellLeave); emptyDataGrid.CellEnter += new DataGridViewCellEventHandler(emptyDataGrid_CellEnter); dataGrid.Scroll += new ScrollEventHandler(dataGrid_Scroll); emptyDataGrid.Scroll += new ScrollEventHandler(emptyDataGrid_Scroll); empt