Forum Discussion

patrick_1's avatar
patrick_1
New Contributor
13 years ago

.NET DataGrid method(s) return error(s)

I'm trying to follow this AQA help post to draft a test that can search for a particular row in a Microsoft DataGrid control and select it for additional interactions (these interactions are the elements I'm actually trying to test).  I've added a few attachments to help explain what I've done. Hopefully this will highlight something obvious I'm missing and be somewhat easily resolved.



Here's what I've done:

  1. I added the DataGrid control to the project properties object mapping for the DataGrid class.  I attached object-mapping-datagrid.jpg to show this.

  2. I mostly copied the JScript script from "Searching Within The Grid" of the help article I linked above and made the code changes for my own application.  I attached script-text.jpg to illustrate the script I'm executing.

  3. When I try to run the script, I get an error that says "97 0x80020006 (Unknown name.) dataGridRowsLength"  This is also the text of the error message in the datagrid-extended-property-errors image I attached.


I'm not sure how to proceed.  Am I missing something obvious?



Thank you in advance,

Patrick



4 Replies

  • Patrick,


    When you map a grid control to DataGrid, you tell TestComplete that it can work with that control in the way it works with Microsoft DataGrid. As far as I can see, the grid control you are testing is neither a Microsoft DataGrid control, nor its descendant control. That is why, TestComplete's methods and properties don't work, and you get error messages.


    Unfortunately, I cannot determine the grid control you are testing. I'd suggest that you ask the developers. If TestComplete supports this control, you can define mapping settings properly and repeat your test actions.


    As TestComplete can access native methods and properties of .NET applications, you can try working with your grid control by using native methods and properties. For example, you can use a native property to get a cell value. To learn which method or property to use, please see the documentation on your grid control or ask the developers.

  • patrick_1's avatar
    patrick_1
    New Contributor
    Thanks for the reply.  Maybe I'm stumbling on semantics with the issue I'm having, but I didn't think so.



    I have the source code for the grid that I'm trying to test; the grid is a customized control class that inherits the System.Windows.Forms.DataGridView class when declared (see datagrid-classdef.jpg).  There are no third-party libraries in the References for the project, so I'm convinced that it's a Microsoft implementation. 



    Should I be pursuing a different avenue to work with the DataGridView object as opposed to the DataGrid object?  Perhaps this is where I'm in the wrong place.





    Thanks again,

    Patrick


  • patrick_1's avatar
    patrick_1
    New Contributor
    Following up.



    I was able to fix this by mapping the object to the DataGridView vs the DataGrid class.  Fortunately the search scripts are the same.  Your tip put me on the right track so I appreciate that.



    Thanks again,

    Patrick