Home Forums WinForms controls Xceed Grid for WinForms Difference between Row and DataRow

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #12973 |

    I’ve been experiencing problems due the fact that a grids DataRows collection returns a DataRow whereas the SelectedRows collection returns a Row. Can someone explain what is the difference between the Row and DataRow objects and why there are two different objects?

    Imported from legacy forums. Posted by TechnoTone (had 2118 views)

    User (Old forums)
    Member
    Post count: 23064

    A DataRow is simply an extension of a Row. The DataRow class inherits from the basic Row class, and provides functionality for individual cells, editing and viewing cell contents, etc.

    If you access the DataRows property, the grid is giving only rows that it knows are DataRows. If you access the SelectedRows property, the grid isn’t sure if you have an InsertionRow selected, or a TextRow that has no cells, etc.

    If you know what kind of rows can be selected in your grid, you can cast them to DataRows using the ctype function in VB, or the casting operator in C#. Otherwise you can check the type of each row as you loop through the SelectedRows, using a “If typeof row is Xceed.Grid.DataRow then” clause.

    Good luck!

    ~Christopher

    Imported from legacy forums. Posted by Christopher (had 3385 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.