Author Topic: Error Importing Form Template  (Read 664 times)

MikeF

  • Newbie
  • *
  • Posts: 10
    • View Profile
Error Importing Form Template
« on: October 19, 2017, 05:55:15 PM »
I'm having some issues using templates to create multiple similar forms in my project. I've been following the procedure in this post: http://advancedhmi.com/forum/index.php?topic=1174.0

After adding the template into the project a prompt appears (error1.jpg) and the design time error page loads (error2.jpg).

Anyone seen this before?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Error Importing Form Template
« Reply #1 on: October 19, 2017, 06:18:08 PM »
If you click on the hyperlink for the error, does it take you to the line of code? If so, what is the code?

MikeF

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Error Importing Form Template
« Reply #2 on: October 19, 2017, 06:49:10 PM »
The link goes to the code view of the designer page. (HMIPromptPage1.Designer.vb)

Looks like all of the components on the template page are causing errors. The first of many lines with errors is this :

Code: [Select]
Me.Label1 = New System.Windows.Forms.Label()

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Error Importing Form Template
« Reply #3 on: October 19, 2017, 06:53:36 PM »
Let's back up to the first error:

- In Solution Explorer, right click the AdvancedHMI project and select properties
- Select the References tab
- Do you see these 4 references:

AdvancedHMIControls
AdvancedHMIDrivers
MfgControl.AdvancedHMI.Controls
MfgControl.AdvancedHMI.Drivers

If not, select Add Reference, then add them to the list

MikeF

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Error Importing Form Template
« Reply #4 on: October 19, 2017, 07:50:19 PM »
Yup. Those are all there.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Error Importing Form Template
« Reply #5 on: October 19, 2017, 08:00:31 PM »
In the designer code where the error is reported, at the bottom do you see several lines of code similar to this:

    Friend WithEvents Label1 As Label

MikeF

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Error Importing Form Template
« Reply #6 on: October 19, 2017, 08:08:55 PM »
Yes.

Every component on the template form has a line similar to that.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Error Importing Form Template
« Reply #7 on: October 19, 2017, 08:20:36 PM »
Go to the top of the page and check the class name to make sure it is not the same name used on another form.

MikeF

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Error Importing Form Template
« Reply #8 on: October 19, 2017, 08:25:08 PM »
The Class name is the same As the form I used to create the template. Do I need to manually change this for every instance of the template?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Error Importing Form Template
« Reply #9 on: October 19, 2017, 08:34:36 PM »
When you added the object, it should have ask for a file name, then gave that name to the form. If it didn't, then you will need to change it's name it two places. In the designer code, then in the regular form code (by right clicking the form in Solution Explorer, then select View Code)

MikeF

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Error Importing Form Template
« Reply #10 on: October 19, 2017, 08:39:54 PM »
Awesome, that seems to have cleared up all the errors. Thanks for the quick response Archie