How can I retrieve the data from ultrawingrid?
Firstly i added the ultrawingrid object to the script (“UltraGrid1Net()”). then
Dim MyTable As UltraGridTestObject
Dim Row As Integer
For Row = 0 To MyTable.GetRowCount() - 1
Dim Col As Integer
For Col = 0 To MyTable.GetColumnCount() - 1
msgbox("Value at cell {0}, {1}, {2}: {3}", ("Row"), ("Col"), ("is"), MyTable.GetCell(Row, Col)))
Next Col
Next Row
I got the above code from net and I modified according to my requirement, when I’m trying to compile the above code it is giving me the following error:
“Type ‘UltraGridTestObject’ is not defined”
Pls let me know is ‘UltraGridTestObject’ is right to use for ultrawingrid or let me know the appropriate object to use.
Hi Ammar,
1)I have added UltraGrid object to Object map. Again i'm getting the same error.('Infragistics.RFT.NetTestObjects.UltraGridTestObject' not defined')
2) i'm unable to import Infragistics.RFT.NetTestObjects namespace in script header.
Do i need to do any manual settings??
Rekha.
Hi Rekha,
Since we are using the fully qualified name then we don't need to import anything. Are you adding the TestObject to the script? if not then you have to do this. You can do it by either record a click on the grid (then you can delete the script line and keep the test object). Another way to add the grid to the TestObject is by
Regards,
Ammar
when i'm using the above code i'm getting "Type 'Infragistics.RFT.NetTestObjects.UltraGridTestObject'
not declared" error.
I need to import any header files??
Another way to do this will be to use the GetData method of the grid test object, here is how:
Dim MyTable As Infragistics.RFT.NetTestObjects.UltraGridTestObject = UltraGrid1Table()
Dim data As Infragistics.RFT.Shared.Values.Array2DValue = MyTable.GetData(Nothing)
Dim outputText As String
For Row = 0 To data.RowCount - 1
For Col = 0 To data.CellCount - 1
outputText = String.Format("Value at cell {0}, {1}, is: {2}", Row, Col, data.GetValue(Row, Col))
LogTestResult(outputText, True)
Hi,
There is a couple of thing to mention in the code you posted:
Here is a code that should do exactly as you wish. (this code will print the text of each cell in the root band, if you want to get the value of the cell instead then you just need replace the name of the property at the end of the GetNAProperty parameter.
Dim MyTable As Infragistics.RFT.NetTestObjects.UltraGridTestObject = UltraGrid1Table()Dim Row As IntegerDim outputText As StringFor Row = 0 To MyTable.GetRowCount(Nothing) - 1 Dim Col As Integer For Col = 0 To MyTable.GetColumnCount(Nothing) - 1 outputText = String.Format("Value at cell {0}, {1}, is: {2}", Row, Col, MyTable.GetNAProperty("Rows[" + CStr(Row) + "].Cells[" + CStr(Col) + "].Text")) 'To get the value of the cells instead of the text use: 'outputText = String.Format("Value at cell {0}, {1}, is: {2}", Row, Col, MyTable.GetNAProperty("Rows[" + CStr(Row) + "].Cells[" + CStr(Col) + "].Value")) MsgBox(outputText) LogTestResult(outputText, True) Next ColNext Row
Please let me know how does that go and mark this post as verified answer if this works out well so others can benefit from it as well