Private Sub table_main_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles table_main.CurrentCellChanged
table_main.Select(table_main.CurrentCell.RowNumber)
table_main. 'WHAT goes here to deselect the editing on that cell
End Sub
Dim selectedRow As Integer = table_main.CurrentCell.RowNumber
table_main.CurrentCell = Nothing
table_main.CurrentRowIndex = selectedRow
Dim selectedRow As Integer = table_main.CurrentCell.RowNumber
table_main.CurrentCell = Nothing
table_main.Select(selectedRow)
What error? Which line? People saying they get an error without further explanation is a pet peeve of mine.genu said:that actually gave me error
Sorry. I'm very not big on downloading entire projects. To be honest, I've never used a DataGrid in a production app, so all I know is from reading and experimentation. I suggest you look at the member list for the DataGrid class and try some things yourself. Also, check out the DataGridTableStyle and DataGridColumnStyle classes. They allow you to modify DataGrid appearance and behaviour although, once again, I've never used them myself.genu said:here is the source...maybe u can try some things
You would remove the first line, i.e. the call to Select. The last line is supposed to be setting the correct row so you don't need to do it twice. This may not get rid of the error though. This is a little bit of a hack but it might work:genu said:here is the error that I got before:
An unhandled exception of type 'System.StackOverflowException' occurred in system.windows.forms.dll
and it highlited: table_main.CurrentCell = Nothing
FROM THIS
table_main.Select(table_main.CurrentCell.RowNumber)
Dim selectedRow As Integer = table_main.CurrentCell.RowNumber
table_main.CurrentCell = Nothing
table_main.CurrentRowIndex = selectedRow
'Get the index of the current row.
Dim selectedRowIndex As Integer = table_main.CurrenRowIndex
'Prevent each change being seen as it is made.
table_main.SuspendLayout()
'Select the first row, which should remove selection from the cell that was clicked.
table_main.CurrentRowIndex = 0
'Select the previously selected row, hopefully without selecting the cell again.
table_main.Select(selectedRowIndex)
'Apply all changes together.
table_main.ResumeLayout()
'Get the index of the current row.
Dim selectedRowIndex As Integer = table_main.CurrenRowIndex
'Prevent each change being seen as it is made.
table_main.SuspendLayout()
'Select the first row, which should remove selection from the cell that was clicked.
table_main.CurrentRowIndex = 0
'Select the previously selected row, hopefully without selecting the cell again.
table_main.Select(selectedRowIndex)
'Apply all changes together.
table_main.ResumeLayout()