CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2002
    Location
    Canada, Québec
    Posts
    20

    CurrentRowIndex in DataGrid don't return the right value

    I have a DataGrid assiciated with a DataSet.
    When the user select a row and click on button, a dialog
    appear for allow to modify this row.

    If I change some information and click on "Accept change" button, I update the dataset and return to the parent form. After the "child form" is closed I update the DataGrid with the new informations.

    But after this CurrentRowIndex return always 0.

    Anyone have an idea how to solve this problem ?
    Martin Bonneville
    Développeur logiciel
    Québec, Canada

  2. #2
    Join Date
    Apr 2002
    Location
    Canada, Québec
    Posts
    20
    I found a solution. It's not a great solution but it work.

    Before updating my DataGrid I do this :

    Dim CurCell As DataGridCell
    CurCell = DataGridListe.CurrentCell()


    After updating :

    DataGridListe.CurrentRowIndex = CurCell.RowNumber



    Now when the user select a row, DataGridListe.CurrentRowIndex return the right value !!!

    VB strike again (you don't know why it's working, but it's working) :-)
    Martin Bonneville
    Développeur logiciel
    Québec, Canada

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured