NullExceptionRefence When Clicking RowHeader of DGV

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
Answered
0
0

Hi,

When I clicked a DGV row header, I got a null exception in CurrentCell.RowIndex and CurrentCell.ColumnIndex in SelectionChanged event.

Thanks.

  • You must to post comments
Best Answer
0
0

Forgot to add that now the DGV can only select rows. The SelectionChanged event fires when the selected rows, and later when supported the selected cells and columns, change.

When the current cell changes it fires CurrentCellChanged. The sequence is:

  1. CellValidating
  2. CellValidated
  3. CellLeave
  4. If leaving the row:
    1. RowValidating
    2. RowValidated
    3. RowLeave
    4. RowEnter
  5. CurrentCellChanged
  6. CellEnter

HTH

Best,

Luca

 

  • You must to post comments
0
0

Hi Luca, Frank

Sorry. Didn’t change my code from CurrentCell to CurrentRow. It’s now working.

Thanks.

  • You must to post comments
0
0

CurrentCell is null when clicking on the row header – do you also get CurrentRow null?

  • You must to post comments
0
0

Hi Frank,

Sorry but I am getting the same error. Please see attached image.

I forgot to mention that pressing left and right arrow keys or mouse-click to navigate to cells on the same row doesn’t fire the SelectionChanged event. It fires with up and down arrow keys of mouse-click on a different row.

Build 1.2.66.0.

Thanks.

  • You must to post comments
0
0

Hi Cris,

WJ-7629 is fixed in the latest build (1.2.66).

Best regards
Frank

  • You must to post comments
0
0

Hi Luca,

Exactly. So that if I test SelectedRows before deleting a row, the test always fails. An option is to click any cell in the same row to delete which doesn’t make sense to me.

Thanks.

  • You must to post comments
0
0

Hi Cris,

The behavior of the DGV when clicking on the row header is slightly different than WinForms. Wisej supports clearing the current cell while WinForms always selects the first visible cell unless cleared by code setting it to -1. In this case the bug is that SelectedRow also returns null while it should be the current row.

It’s WJ-7629.

Best,

Luca

  • You must to post comments
Showing 7 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 1, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json