Author Topic: New page not available in designer mode  (Read 2186 times)

SOUS

  • Newbie
  • *
  • Posts: 6
    • View Profile
New page not available in designer mode
« on: May 12, 2018, 04:08:08 PM »
 :-[
Sorry to have to ask this, but i'm struggling trying to add a third page into my project. I tried to find some hints in the forum, but found nothing helpful.
I'm a beginner with VB, (using Visual Studio 2017 community)
I am adding a windows form by right clicking on AdvancedHMI then choosing Class and whatever i do i can't get this new page available from a FormChange button, or even get it to open in designer mode.
What am i doing wrong... ?
« Last Edit: May 12, 2018, 04:15:40 PM by SOUS »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: New page not available in designer mode
« Reply #1 on: May 12, 2018, 04:34:36 PM »
You need to choose "Windows Form" instead of "Class", just like the attached picture shows.

Then you can also add the following code to it:

Code: [Select]
    '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    '* Copy this section of code to every new form created
    '*******************************************************************************
    Private NotFirstShow As Boolean

    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        '* Do not start comms on first show in case it was set to disable in design mode
        If NotFirstShow Then
            AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
        Else
            NotFirstShow = True
        End If
    End Sub

The other way of creating a new form would be to copy existing form, like Page2.vb, and then paste it to AdvancedHMI project. The exact steps would be:

- right-click Page2.vb and then click Copy
- right-click AdvancedHMI project and then click Paste
- rename this newly created copy to whatever name you want
- right-click  this newly created copy and then click View Code
- replace Page2 with your new name in the following line: Public Class Page2
« Last Edit: May 12, 2018, 04:44:45 PM by Godra »

SOUS

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: New page not available in designer mode
« Reply #2 on: May 12, 2018, 04:45:51 PM »
Thanks for the reply, but i've already tried this one, and whatever i choose in the next Windows does not seem to work.
 

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: New page not available in designer mode
« Reply #3 on: May 12, 2018, 04:50:20 PM »
Once you add a new form then close all the forms and re-open them.

If necessary, close the solution or Visual Studio and re-open it.

Archie suggested to build the project, in this post:

https://www.advancedhmi.com/forum/index.php?topic=170.msg461#msg461
« Last Edit: May 12, 2018, 04:55:26 PM by Godra »

SOUS

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: New page not available in designer mode
« Reply #4 on: May 12, 2018, 05:24:23 PM »
Nope, still do the same thing.

Nevertheless, i figured out i could just copy and paste the page2 and rename it page3...
I gaves me a couple of building errors, but from the output windows, i have been able to open the new page3 designer page in "code view" then rename Page2 to page3 into it, then it finally works...
Sounds weird, i guess something might be wrong with my Visual Studio settings...

Anyways, thanks for your time!

bejoe

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: New page not available in designer mode
« Reply #5 on: July 23, 2018, 12:20:00 PM »
Hi, same problem with me on add window form, the copy & paste also not working. Any video as tutorial?

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: New page not available in designer mode
« Reply #6 on: July 23, 2018, 08:24:07 PM »
All the information posted in this topic should be sufficient to resolve the issue (which seems to be related to the Visual Studio installation on one's computer).

bejoe

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: New page not available in designer mode
« Reply #7 on: July 24, 2018, 06:44:37 AM »
Thanks Godra,
Re-install the VS2017 than its work.