DataGrid - how to detect a row changed?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: DataGrid - how to detect a row changed?

  1. #1
    Join Date
    May 2000
    Location
    Israel
    Posts
    125

    Question DataGrid - how to detect a row changed?

    Hi

    How can I detect in a C# program using a DataGrid, that the user selected a row? In VB there used to be a RowColChange event fired, but I cannot find a similar one in C#.

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    try this in DataGrid's Click event,

    System.Drawing.Point pt = this.PointToClient(Cursor.Position);
    DataGrid.HitTestInfo hti = yourdatagrid.HitTest(pt);
    if(hti.Type == DataGrid.HitTestType.Cell)
    {
    int row= hti.Row;
    yourdatagrid.Select(row);
    }

    you can write a delegate/event when row is selected if you are making custom control out of it.


    Paresh
    - Software Architect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center