Author Topic: v3.97d EthernetIPforCLX stops in MainForm when closing another form  (Read 1323 times)

scott.clark

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
I just updated an application from version 3.97 to v3.97d

In my MainForm.vb,  I have a "EthernetIPforCLX_MainForm" instance of EthernetIPforCLX running.  From the MainForm.vb I open another form, frmPLCManualMode.vb that has a "EthernetIPforCLXCom_frmPLCManualMode" instance of EthernetIPforCLX.   Both forms update the PLC objects at this point.  I then close this form with the following code:

Code: [Select]
    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        EthernetIPforCLXCom_frmPLCManualMode.CloseConnection()
        EthernetIPforCLXCom_frmPLCManualMode.Dispose()
        Me.Close()
    End Sub

This closes the frmPLCManualMode.vb form causes the "EthernetIPforCLX_MainForm" instance of EthernetIPforCLX to stop updating.

I also tried commented out the the close and dispose lines from the above code, but same result.


This worked before in in an older version of AdvancedHMI.  Any suggestions?
Thanks!

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: v3.97d EthernetIPforCLX stops in MainForm when closing another form
« Reply #1 on: January 23, 2015, 12:49:58 PM »
In the main form code is an event handler for VisibleChanged. Comment out that one line and see what effect it has

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: v3.97d EthernetIPforCLX stops in MainForm when closing another form
« Reply #2 on: January 23, 2015, 02:43:01 PM »
In this case, the CloseConnection and Dispose calls are not necessary, it will be done automatically after the form is closed.

A better practice is to hide the form so when it is reopened, it will come up faster. If you include the VisibleChanged event handler as on the MainForm, then when form is hidden, it will pause the communications for that form.

scott.clark

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: v3.97d EthernetIPforCLX stops in MainForm when closing another form
« Reply #3 on: January 23, 2015, 04:54:09 PM »
Thank you for the suggestions, works very nice.