m0_37560965
so-seriously
2017-09-21 02:01

vb.net通过Winsock 往PLC寄存器D写textbox里数值怎么写啊

30
  1. Private Sub butWrite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butWrite.Click
  2. Dim i As Short
  3. Dim temp() As String
  4. Dim WD() As Object
  5. If Not EntLink Then
  6. MsgBox("还未与PLC建立联接!")
  7. Exit Sub
  8. End If
  9. ReDim WD(Val(txtWriteCnt.Text) - 1)
  10. temp = Split(txtWrite.Text, vbCrLf)
  11. For i = 0 To UBound(WD) Step 1
  12. If i > UBound(temp) Then
  13. WD(i) = 0
  14. Else
  15. WD(i) = Trim(temp(i))
  16. End If
  17. Next i
  18. ScanRet = PLC.CmdWrite(cmbWriteMry.SelectedIndex + 1, cmbWriteType.SelectedIndex + 1, Val(txtWriteAdd.Text), Val(txtWriteCnt.Text), WD)
  19. txtReWrite.Text = ScanRet.ToString
  20. End Sub
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答