General Category > Open Discussion

LineShape1

(1/1)

gerhardj:
Hi
I am new to Visual Studio. I have a LineShape1 that I want to move across a IP Camera input.
I got the line to move on click event, X1 and X2 value from PLC, Y1 and Y2 Set values. How can I make it update continuously

   Private Sub LineShape1_Click(sender As Object, e As EventArgs) Handles LineShape1.Click
        Me.LineShape1.BorderColor = System.Drawing.Color.Red
        Me.LineShape1.BorderWidth = 2
        Me.LineShape1.Name = "LineShape1"
        Me.LineShape1.X1 = 500 - EthernetIPforCLXComm1.ReadSynchronous("Axis1.RMCActPosition", 1)(0)
        Me.LineShape1.X2 = 500 - EthernetIPforCLXComm1.ReadSynchronous("Axis1.RMCActPosition", 1)(0)
        Me.LineShape1.Y1 = 100
        Me.LineShape1.Y2 = 500
    End Sub

Archie:
There are a couple ways you could do this. The simplest would be to add a timer to your form, set the Enabled to true, double click then timer, then put your code in the Tick Event handler.

A more complicated, but more efficient method would be to subscribe to the PLC Address. You can see an example of this in post #26 in this thread:

http://www.plctalk.net/qanda/showthread.php?t=51758&page=2

gerhardj:
Thanks Archie
The timer worked. I will play with the other one.

Navigation

[0] Message Index

Go to full version