Author Topic: Form stops running  (Read 3545 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Form stops running
« Reply #15 on: August 26, 2015, 10:25:25 PM »
Code: [Select]
Private Sub DataSubscriber3_DataReturned(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber3.DataReturned
        Me.currentValue = e.values(0)
        vesselFillRate = (Me.currentValue - Me.lastValue) * 6
        Me.BasicLabel4.Value = vesselFillRate 'This you could change to CInt(vesselFillRate) to get round value
        Me.lastValue = Me.currentValue
End Sub

Cowboy1

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Form stops running
« Reply #16 on: August 26, 2015, 10:52:20 PM »
Archie,


Thanks for your help with this it works perfectly a lot smoother than the timer I stepped up the poll rate just to see response until I get actually running in the next couple of weeks. I posted the complete code for anybody that might use it for reference in the future.

Code: [Select]
Private lastValue As Single
    Private currentValue As Single
    Private vesselFillRate As Single
    Private Sub DataSubscriber3_DataReturned(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber3.DataReturned
        Me.currentValue = e.values(0)
        vesselFillRate = (Me.currentValue - Me.lastValue) * 6
        Me.BasicLabel4.Value = vesselFillRate 'This you could change to CInt(vesselFillRate) to get round value
        Me.lastValue = Me.currentValue
    End Sub

End Class