Home Forums WinForms controls Xceed Grid for WinForms Get value of a cell by current row

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

    How can I get value of a given cell by currentrow property?

    Imported from legacy forums. Posted by PETE (had 3662 views)

    User (Old forums)
    Member
    Post count: 23064

    Alas ! I got the answer.. so soon.

    Here is the code:

    Dim row As New DataRow()
    row = grdGIV.CurrentRow
    MsgBox(row.Cells(0).Value)

    Imported from legacy forums. Posted by PETE (had 449 views)

    User (Old forums)
    Member
    Post count: 23064

    I don’t think you need to create a new DataRow. Your code works, but the <b>New DataRow()</b> isn’t necessary. You can just use <b>Dim row As DataRow</b>, unless my VB is not correct.
    You don’t even have to put it in a variable: you can just say <b>MsgBox(grdGIV.CurrentRow.Cells(0).Value)</b>

    Imported from legacy forums. Posted by Tommy (had 291 views)

    User (Old forums)
    Member
    Post count: 23064

    Me too thought the same way and tried in vain.

    There is no ‘Cells’ property for ‘currenRow’, if I am not wrong. Thats why I created a new Datarow.

    Imported from legacy forums. Posted by PETE (had 479 views)

    Xceed Support
    Member
    Post count: 5658

    Hello,

    The CurrentRow can be any type of row, therefore its type is “Row”. In the case where a DataRow is the CurrentRow, you would need to verify the type and cast it as a DataRow in order to access its Cell collection.

    Dim row As DataRow = grid.CurrentRow

    If Not row Is Nothing Then
    row.Cell( “myCell” ).Value
    End If

    Imported from legacy forums. Posted by Jenny [Xceed] (had 4819 views)

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