Forum Discussion

JonasM's avatar
JonasM
New Contributor
13 years ago

TestComplete 8 and Delphi TDBGrid

Hi there,



i'm using TestComplete 8 and wanted to get the values of an Delphi TDBGrid.



I obtain all properties except the values. The program justs shows me the following message:



Error

An error occurred.

Possible reasons:

1. The application stopped responding.

2. The application was compiled incorrectly (see the Open Applications topic in the help system).

3. An error occurred in TestComplete.



Technical information:

103 0x80020006 (unknown name.) Count.





I tried:


  • to use a code from the Obtaining and Setting Cell values page

  • checked if there is an object mapping entry

  • read the help pages


but the results are just the same.





Hope you can help



Jonas

3 Replies

  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Jonas,


    Could you please post here the code that you are using to get the target value? It will be very helpful for the problem's investigation.


    Thanks.

  • JonasM's avatar
    JonasM
    New 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.