Hi guys
Sorry if I raise a very commonly asked question, but I spent the whole day searching the net and your forums and still found nothing on my issue.
I have a three-level hierarchical grid (UltraGrid), I need to get cell values from the second and third grid bands.
I can fetch the data from the first level grid without any issues, but when I need to go one or two levels deeper, it gets rather tricky.
Could you give me an example how do one fetches data from hierarchical grids over the multiple layers, please?
Eugene,
MsgBox SwfWindow("Form1").SwfTable("ultraGrid1").GetCellData("0;0;2","Quantity")
In a case where you have a grid with three levels this code would display the value in the "Quantity" column of the third row in the first child row of the first row in the grid. In other words, the third row of Band[2] in the grid.
Thanks Michael!
How could I refer to the sub-level grid as an object? Say, for example, to the mentioned third level grid?
Hi Michael,
Thanks for the reply. i too really don't know wrong. but i tried executing your project which you zipped. it gave me some error.
"
Error 10 Unable to resolve type 'Infragistics.Win.UltraWinGrid.UltraGrid, Infragistics4.Win.UltraWinGrid.v12.1, Version=12.1.20121.2024, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' C:\Hari\C#Course\SamplesApps\GridInCodeTest\GridInCodeTest\GridInCodeTest\Properties\licenses.licx 1 GridInCodeTest
i am believing It may be a license issue. in project i am using UltraWinGrid.v8.3
-Hari
If you are using NetAdvantage 2008 volume 3 then you should use the Version Utility to downgrade my sample project to 8.3 You will also have to change it to CLR2. You should also clear out any text in the licenses.licx file.
Hari,
I have attached a new version of the sample application. This one was built using Visual Studio 2008 with NetAdvantage 2008 volume 3. It seems to work fine. Take a look at it and let me know what you think.
what ever the code you gave is worked fine, but you just comment following one line of code you could see the same error as below.
//this.Controls.Add(tempUltraGrid); tempUltraGrid.DisplayLayout.Rows[0].Selected = true;
"Index was outside the bounds of the array."
OK, I didn't realize you were never adding your grid to a Form. That makes a big difference. Evidently if the grid is not added to the Controls collection of a Form (and the Form is shown), the grid will have no BindingContext. You can get around this by setting the BindingContext of the grid to the BindingContext of the Form, (or setting it to a new BindingContext). I have attached a new version of the sample application which does this so you can see how it works.
It is probably not a good idea to not add the grid to a Form because you can have a potential memory leak. Why are you not adding the grid to a Form? If you don't want to see the grid you can set its Visibility to false. Anyway, I hope this is helpful.
Did that suggestion work for you?