Alternative for RowData and flexcpData

Posted by: w.wolf on 23 April 2020, 11:01 am EST

    • Post Options:
    • Link

    Posted 23 April 2020, 11:01 am EST

    I worked with .RowData() and .Cell(flexcpData) in the ActiveX version. What alternatives are there in the winforms edition?

    Greetings W. Wolf

  • Posted 23 April 2020, 12:48 pm EST

    I just found .UserData. Is that correct?

  • Posted 24 April 2020, 6:44 am EST

    Hi W. Wolf,

    Yes, you can use the UserData property to achieve the same as you can do with RowData() and .Cell(flexcpData) in the ActiveX version.

    Note: VSFlexGrid of ActiveX and C1FlexGrid of WinForms are different at the architectural level so it may be possible that you can not find some similar property in these controls.

    If you need any other then please feel free to ask.

    Regards,

    Prabhat Sharma.

  • Posted 27 April 2020, 4:45 am EST

    Hi,

    I used .RowData () to identify a record. Example:

    
    For r = 0 To .Rows.Count - 1
    	.Rows(r).UserData = r
    Next
    ...
    Private Sub Grid_AfterSort(...) Handles Grid.AfterSort
            For r As Integer = 0 To Grid.Rows.Count - 1
                Debug.Print(Grid.Rows(r).UserData)
            Next
    End Sub
    'i still get: 0,1,2,3,4,5.... regardless of the sorting
    
    

    UserData is not bound to the row. With RowData () that was still the case. I found the same problem in the CellNotes sample project. If you sort there, the note assignments are no longer correct. What can I do?

    In the ActiveX version I was able to search the RowData values with the .Find method and thus identify a row. How do I do that in WinForms?

    Regards,

    W. Wolf

  • Posted 28 April 2020, 7:08 am EST

    Hi W. Wolf,

    The UserData value is fixed with the indexes of the Rows, Columns, and cell and it will not change in case of sorting.

    As a workaround, you can add an extra column in the grid and set the internal data in its cell that you want to associate with the row. In the final output, you can hide the extra column that you are using.

    The workaround sample is attached below.

    Regards,

    Prabhat Sharma.

    UserRowDemo.zip

  • Posted 29 April 2020, 4:06 am EST

    Thanks for the example. I’ve also done it that way. However, this is not a good solution. Sorry, that worked a lot better in the ActiveX version.

    Regards,

    W. Wolf

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels