none
Form with DataGridView closes when I select a cell not in first column RRS feed

  • Question

  • I have the SelectionMode of a DataGridView set to CellSelect, yet when I have a single row in the DGV, it highlights the cell in the first column (I think by default).  If I select any other cell in the row, the form closes.  Is this normal behaviour?  If not, how do I change it, if possible?
    Friday, August 23, 2019 7:37 AM

All replies

  • Hi RichardDunneBSc,

    Welcome to MSDN forum.

    Based on your description, please set the breakpoints on related code about the cell is clicked, or use "try...catch...", then debug to check if it would throw an exception.

    Look forward to your reply.

    Best Regards,

    Dylan



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, August 23, 2019 9:44 AM
  • Hi RichardDunneBSc,

    When you choose the CellSelect in the DatatGridView, it is impossible to select the entire row or column by clicking the header but click a cell selects that cell.

    So l am afraid that there is something wrong in your program. Did you have a cell click event? So please check your code about the related events and datasource of the datagridview.

    You can refer this document to understand it:

    https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/selection-modes-in-the-windows-forms-datagridview-control

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, August 27, 2019 8:08 AM