Forum Discussion
JonasM
13 years agoNew Contributor
I just used the script out of the help library:
'[TestComplete VBScript]
Sub getDBGrid
Set p = Sys.Process("GridTest")
Set Grid = p.VCLObject("MainForm").VCLObject("DBGrid1")
' Get the cell value
s = GetCell(Grid, 1, 1)
Log.Message s
End Sub
' Get the cell by its row and column indexes (zero-based)
Function GetCell(GridObject, Row, Col)
' Get the field name
FldName = GridObject.Columns.Items(Col).FieldName
' Activate the row
Call ActivateRow(GridObject, Row)
' Get the field text
Set Fld = GridObject.DataSource.DataSet.FieldByName(FldName)
GetCell = Fld.AsString
End Function
' Activate a row by its index (zero-based)
Sub ActivateRow(GridObject, RowIndex)
Call GridObject.DataSource.DataSet.First()
Call GridObject.DataSource.DataSet.MoveBy(RowIndex)
End Sub
but the result is the same as the result from the property/table checkpoint.
I get all properties except for the values. There I get the error message from above.
'[TestComplete VBScript]
Sub getDBGrid
Set p = Sys.Process("GridTest")
Set Grid = p.VCLObject("MainForm").VCLObject("DBGrid1")
' Get the cell value
s = GetCell(Grid, 1, 1)
Log.Message s
End Sub
' Get the cell by its row and column indexes (zero-based)
Function GetCell(GridObject, Row, Col)
' Get the field name
FldName = GridObject.Columns.Items(Col).FieldName
' Activate the row
Call ActivateRow(GridObject, Row)
' Get the field text
Set Fld = GridObject.DataSource.DataSet.FieldByName(FldName)
GetCell = Fld.AsString
End Function
' Activate a row by its index (zero-based)
Sub ActivateRow(GridObject, RowIndex)
Call GridObject.DataSource.DataSet.First()
Call GridObject.DataSource.DataSet.MoveBy(RowIndex)
End Sub
but the result is the same as the result from the property/table checkpoint.
I get all properties except for the values. There I get the error message from above.
Related Content
- 3 years agomitov
- 12 months agolalit_singh
- 2 years agomattb
- 2 years agomattb
Recent Discussions
Check PopupMenu exists
Solved2 days agomfoster711- 3 days agosimonaferrara
- 3 days agomacheshmeh