Forum Discussion

jhgreen's avatar
jhgreen
Contributor
8 years ago

Unable to execute user forms in new project.

I set up additional testcomplete projects. For the user forms I went and added existing user forms to the new project. Every time I execute the form I keep getting unable to execute the "Onshow" event of the "Root_0AA8315E_7F1E_44C7_9CC8_9A3C7AfB163: object.

How do I resolve this project. It would seem very tedious to have recreate the forms for the new projects.

  • jhgreen's avatar
    jhgreen
    8 years ago

    The problem I ran into was that if I had multiple projects sharing the same form once I associate the event handler for one

    project it brings the other project.

     

    Was able to resolve the issue.

     

    Had to copy the user forms into the separate projects and not have the forms shared amongst the projects.

     

    Thanks,

    Jeff

  • jhgreen's avatar
    jhgreen
    8 years ago

    Thanks for that suggestion.

     

    I really like that approach.

     

    Thanks,

    Jeff

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    OnShow event handlers are linked to code units and methods. You may have added the form, but the code being utilized for the event handler may not be present in your current project. Double check that and see what you have linked to OnShiw
    • jhgreen's avatar
      jhgreen
      Contributor

      I have also added the code for the onshow event from the other project using add existing file to the new project. In addition,

      I have also attempted to create new file and just copied the onshow event function and still get same error.

       

      FYI, I have also reassociated the onshow event to the specific file and function associated with form.

       

      It works in the base project but not in the new project

       

      Jeff

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Just tried it myself....

         

         

        1) Created a form in one project

        2) Added an "OnShow" event handler to that form in a script unit in that same project

        3) Created a new project

        4) Added both the form and the script unit as "Add Existing Items" to the new project

        5) Reassociated the event handler in the new project.

         

         

        Worked fine.

         

        Could you give the full text of the error message you're getting?  I DID reproduce an error, but only if I didn't have the code units and such in place.  The error I got read:


        Unable to execute the "OnShow" event of the "Root_0AA8315E_7F1E_44C7_9CC8_9A3C7AF4B163" object. The "UserForm1_OnShow" method cannot be found or it has an invalid number of parameters.