Author Topic: Form Exit Suddenly  (Read 1541 times)

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Form Exit Suddenly
« on: August 24, 2015, 05:15:32 AM »
I am using AHMI-V398t, I have 2 forms: form 1 and form 2.
Form 1 has FormChangeButton component to navigate to Form 2.
Form 2 has FormChangeButton component to navigate to Form 1.

I try navigating continuously from Form 1->Form 2->Form 1->Form 2->etc...
This works fine if I let to have some delay in between (about 1 second).
But if I rapidly navigate, the Form will exit automatically.
No error message, nothing.

Please advise a solution regarding this.
Thank you.

Best regards,
Andrew

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Form Exit Suddenly
« Reply #1 on: August 24, 2015, 07:42:12 AM »
The form change button uses a short time overlap in transitioning between forms for aesthetic purposes on slower systems. This also creates a small opportunity of time in which you can get both forms hidden. If you open FormChangeButton.vb and go to line 92, you can shorten that time delay:

        ht.Interval = 250

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: Form Exit Suddenly
« Reply #2 on: August 24, 2015, 09:02:22 PM »
Hi Archie,

I changed until ht.Interval = 10, but at some point the form is still closed.
Then I tried changing to 0 and test again, but suddenly the Visual Studio crash.

Now everytime I open AdvancedHMIv35.sln, it is always crash.
So I debug, and the error in attachment appears.
Please advise the solution.
Thank you.

Best regards,
Andrew

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Form Exit Suddenly
« Reply #3 on: August 24, 2015, 10:18:21 PM »
Close Visual Studio and delete the following directories:

\AdvancedHMI\bin
\AdvancedHMI\obj
\AdvancedHMIControls\bin
\AdvancedHMIControls\obj
\AdvancedHMIDrivers\bin
\AdvancedHMIDrivers\obj

re-open AdvancedHMI and Rebuild Solution

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: Form Exit Suddenly
« Reply #4 on: August 24, 2015, 10:30:19 PM »
Thanks, now I can open Visual Studio and run the application.

Do you have suggestion for the FormChangeButton?
I understand if it has some delay to support transition.
But when the application exit suddenly, end-user will be confused and think of it as bug.

Best regards,
Andrew

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Form Exit Suddenly
« Reply #5 on: August 25, 2015, 03:44:42 AM »
You can use a regular windows button:

- From  the All Windows Forms group in the Toolbox, add a Button to your form
- Double click the button to get back to the code
- Enter this code:

Form2.Show
Me.Hide


Change Form2 to the name of the form you want to show

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: Form Exit Suddenly
« Reply #6 on: August 25, 2015, 03:48:15 AM »
Ok, thanks Archie.