181
Support Questions / Re: Force a value from HMI into plc address
« on: November 03, 2014, 12:55:10 PM »
I'm using a trackbar with a range from 0 to 16383 , I also have the value display in a label , then using a button click the value is forced into the integer in the code below. what I would like is to have the value go into N14:50 automatically from the trackbar and not have to use the button to force the value.
'Writes the value from TrackBar1 into the PLC address N14:50
Try
EthernetIPforPLCSLCMicroCom1.Write("N14:50", TrackBar1.Value)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
This is the code I used for the TrackBar & the Label
Private Sub TrackBar1_Scroll(sender As System.Object, e As System.EventArgs) Handles TrackBar1.Scroll
End Sub
Private Sub TrackBar1_ValueChanged(sender As Object, e As System.EventArgs) Handles TrackBar1.ValueChanged
Label11.Text = "Analog Out = " &
Format(TrackBar1.Value, "#")
End Sub
Private Sub Label12_Click(sender As System.Object, e As System.EventArgs) Handles Label12.Click
TrackBar1.Value = CInt(CType(sender, Label).Text)
End Sub
Darrell
'Writes the value from TrackBar1 into the PLC address N14:50
Try
EthernetIPforPLCSLCMicroCom1.Write("N14:50", TrackBar1.Value)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
This is the code I used for the TrackBar & the Label
Private Sub TrackBar1_Scroll(sender As System.Object, e As System.EventArgs) Handles TrackBar1.Scroll
End Sub
Private Sub TrackBar1_ValueChanged(sender As Object, e As System.EventArgs) Handles TrackBar1.ValueChanged
Label11.Text = "Analog Out = " &
Format(TrackBar1.Value, "#")
End Sub
Private Sub Label12_Click(sender As System.Object, e As System.EventArgs) Handles Label12.Click
TrackBar1.Value = CInt(CType(sender, Label).Text)
End Sub
Darrell