Forum Discussion

sastowe's avatar
sastowe
Super Contributor
12 years ago

VB 6 control arrays with different indices and runtime

So I was creating a script to test something in my app. The object I needed was a button under the IMResize_3 object. I used name mapping. Looked lovely. When I ran the project, I receive the following message in the log



There are several objects in the system that match the recognition attributes of the "IMResize_3" mapped object.



This may cause the "Object not found" error.



Objects



....VBObject("imcfgedForm").VBObject("IMResize")



....VBObject("imcfgedForm").VBObject("IMResize_2")



....VBObject("imcfgedForm").VBObject("IMResize_3")



To solve the problem, you may need to modify mapping settings for the "IMResize_3" object or one of its parent objects.





On the form, there is only one IMResize object, I think. At form load or whatever they are doing, the programmers must be creating a control array or some such. Runtime when I observe the object, it looks like it is under IMResize_2.



I have a button under that resize object that I want to click. This is where the error is occuring.



How does one use name mapping in a situation like this to make the code cler yet still find the object.



I read about conditional mapping, but I confess it remains unclear to me and may not apply to this situation at all.



Thanks

2 Replies

  • sastowe's avatar
    sastowe
    Super Contributor
    I did. For my application, the indeces are fixed.  IMResize(1) is always (1). When I went to map the object, the object name mapping wizard was using the NativeVBObject property to identify the object by default.  I added the Index property to the object name mappign wizard to id the specific index I wanted to map. So then I had three distinct objects in the name mapping identified by INDEX not the NativeVBObject property which was the same for all of the objects.
  • Hi Stephanie,



    Did you ever find a solution for this? I'm having the same issue. I have multiple combo boxes in a control array. They all have the same name with different indices and TestComplete can't tell the difference between them.



    Thanks.

    Jason