Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'This is the call from the polling thread
- myPoint.SetCurrentValue(singleAry(.PointUDFs("ModuleIndex")._Value))
- 'This is the event def in the Point
- Event ValueChanged(ByVal NewValue As Double, ByVal DisplayNormal As String, ByVal UnitText As String)
- 'This is the function that is entered from the call in the polling thread
- 'All it does is some logic and conversion then calls ValueChanged event
- Public Function SetCurrentValue(ByVal inValue As Double, _
- Optional ByVal RaiseEvents As Boolean = True, _
- Optional ByVal inNewValue As Double = 0, _
- Optional ByVal DisplayNormal As String = "") As Boolean
- 'This is the value changed event. I have different ones, but this is one example that controls a percent bar
- Private Sub _myPoint_ValueChanged(ByVal NewValue As Double, ByVal DisplayNormal As String, ByVal UnitText As String) Handles _myPoint.ValueChanged
- CurrentValue = NewValue
- hpbProgresBar.SetValue(Int(NewValue))
- SetTextPercent(NewValue)
- End Sub
- 'This is how I change the gui in the form using a delegate
- Delegate Sub SetTextPercentDelegate(ByVal inValue As Double)
- Private Sub SetTextPercent(ByVal inValue As Double)
- If lblPercent.InvokeRequired Then
- Dim d As New SetTextPercentDelegate(AddressOf SetTextPercent)
- Me.Invoke(d, New Object() {inValue})
- Else
- lblPercent.Text = Int(inValue) & " %"
- End If
- End Sub
Add Comment
Please, Sign In to add comment