Hello.
I am programming against several methods that take as parameters UltraWinGrids and UltraGridRows.
I need to select a certain number of rows from a first UltraWinGrid and copy them into a second UltraWinGrid, to pass the second as a parameter into the method.
Currently I am casting the Grid1.DataSource as DataSet1, performing my selection logic on DataSet1, then creating a new DataSet2 with the elements of DataSet1 that passed the selection routines. At this point, new Grid2 is created, and the DisplayLayout of Grid1 is copied into Grid2. I then bind Grid2 to DataSet2.
The problem I have is that even though the Grid2.DataSource is pointing to my DataSet2 and filled with data, the Grid2.Rows collection is empty.
The existing method takes an UltraWinGrid in and picks off the UltraGridRows. As you can imagine, I cannot change the existing code.
How can I make this work?
Hi,
You kinda lost me in your description.
So you are creating a DataSet and an UltraWinGrid in code and it's showing no rows? Is that the issue?
My guess is that you are not parenting the grid to any form or anything, so it has no BindingContext. The easiest thing to do in order to get around that is to assign the BindingContext of the second grid to the BindingContext of the first grid.
You are correct in your understanding of my issue, and your suggestion is also correct. Thank you.