Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
How can I populate data in a WinGrid programmatically?
posted

Hello everyone,

I am writing a VB.Net program and I am using a WinGrid to display data. I don't want to set the DataSource property of WinGrid and make the Grid populate the data automatically. What I need to do is loop on the data and create a new row and assign the values to its cells accordingly.

I know this might not be a good practice but I need to do that because I have a column of data that will not be shown in the Grid. Instead, its data will be assigned to the Row's Tag property.

Your assistance is highly appreciated.

  • 4160
    Offline posted

    Hello

    You could databind the grid to an UltraDataSource, hide the column you refer to, and place the following line in the AfterRowUpdate event handler:

    e.Row.Tag = e.Row.Cells("MyHiddenColumn").Value

    Hope this helps.

    Regards.

     

  • 469350
    Offline posted

    The grid cannot be used completely unbound, it needs some kind of data source in order to work. If you want to populate the grid manually in code, then I recommend binding it to an UltraDataSource. Then you could just add rows to the UltraDataSource in code to populate the grid.

  • 40
    posted

    Thank you guys, I am trying to do that. I am currently reading the Online Documentation for both WinGrid and UltraDataSource. Thanks again for your prompt response.