Welcome to the Xceed Community | Help
Community Search  
More Search Options

QTP can not get cell value from Xceed grid

Sort Posts: Previous Next
  •  06-11-2012, 2:11 AM Post no. 32229

    QTP can not get cell value from Xceed grid

    Attachment: ScreenShots.png

    QTP is identifying the grid as a generic object (SwfObject:grid) and not really a toolbar (Swfgrid)

    How can i get the value out of the cells in the grid? Please find the first attachment, I would like to get cell values out of grid and compare with expected result.

    Application under test is windows form using Xceed.Grid, a data grid control for .NET and Xceed.Grid version number is 3.7.8257.17090.

    In Screen shot
    1. First picture shows grid, I would like to get value "1" from data row (0) and column Time4.
    2. Second Picture: I tried to use "Dot Net Windows Form Spy", I can not see the cell value in the "Grid Data row properties"
    3. Third Picture: I tried to use following code in QTP

    If i type "Set x = SwfWindow("FormName").SwfObject("grid").Object.DataRows." and following options were displayed and can not find cell

    If i type "Set x = SwfWindow("FormName").SwfObject("grid").Object.DataRows(0)." no options were given by QTP and on executing, I get following error "Object required: 'SwfWindow(...).SwfObject(...).Object.DataRows(...)'"

    If i type  "Set x = SwfWindow("FormName").SwfObject("grid").Object.DataRows.Item(" some options are displayed, on selecting any option, following error is thrown by QTP error "Object required: 'SwfWindow(...).SwfObject(...).Object.DataRows(...)'"

    I tried following scenarios as well:
    Scnerio 1:
    I tried to use code suggest by Charles Bérubé-Rémillard Technical Support Xceed Software Inc, in link
    http://xceed.com/CS/forums/thread/3105.aspx
    <code>
    Dim dataSource As Object = gridControl1.DataSource

    Dim bs As BindingSource = DirectCast(dataSource, BindingSource)

    Dim value As Integer = CInt(gridControl1.DataRows(0).Cells(0).Value)
    </code> 

    i am not sure what is "gridControl1" in the above code.
    I thought gridcontrol in my case is "SwfWindow("FormName").SwfObject("grid")" and altered the code to 

    Dim value As Integer = CInt(SwfWindow("FormName").SwfObject("grid").DataRows(0).Cells(0).Value)

    QTP is throwing Syntax error, not sure how to fix it.

    Senario 2:
    As mentioned in last comment in link http://xceed.com/CS/forums/thread/3105.aspx

    Set accSumGrid = swfwindow("CMD View").SwfObject("grid").Object
    Set myDs = accSumGrid.DataSource

    For i= 0 to (myDs.Rows.Count -1)
    For j = 0 to 3
    msgbox myDs.Rows.Item(i).Item(j)
    Next
    Next

    In my case i tried
    Set accSumGrid = SwfWindow("FormName").SwfObject("grid").Object
    Set myDs = accSumGrid.DataSource

    For i= 0 to (myDs.Rows.Count -1)
    For j = 0 to 3
    msgbox myDs.Rows.Item(i).Item(j)
    Next
    Next


    "myDs.Rows.Count" did not work and as well as "myDs.Rows.Item(i).Item(j)"

    SwfWindow("FormName").SwfObject("grid").Object. does not have rows option

    Can you please help me


  •  06-11-2012, 2:41 AM Post no. 32230 in reply to 32229

    Re: QTP can not get cell value from Xceed grid

    sorry did not mention the following:

    Set x = SwfWindow("FormName").SwfObject("grid").Object.DataRows
    y = x.Count
    MsgBox y

    this code works and 18 is displayed, which is correct.
    as shown in third picture of the screen shot, count is available and it works. also all the other options that can be used is also displayed.

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.