我的程序如下 我想把温度和压强给定值用一个“发送”按钮发送出去,程序怎么写(下面是两个“发送”按钮的程序,请各位帮帮忙,初学不懂 )
程序:
Private Sub Command4_Click() '传送环境温度
Dim strout As String
Dim str As String
Dim QQ As String
Dim pp As String
Timer1.Enabled = False
pp = Text2.Text
QQ = Hex(pp)
If Len(QQ) = 3 Then
QQ = "0" & QQ
ElseIf Len(QQ) = 2 Then
QQ = "00" & QQ
ElseIf Len(QQ) = 1 Then
QQ = "000" & QQ
End If
str = "01061202" + QQ '传入D514,具有停电保护功能
LRCC = LRC(str)
strout = ":" + str + LRCC + Chr$(13) + Chr$(10)
MSComm1.InBufferCount = 0
MSComm1.Output = strout
Timer1.Enabled = True
End Sub
Private Sub Command5_Click() '传送环境压强
Dim strout As String
Dim str As String
Dim QQ As String
Dim pp As String
Timer1.Enabled = False
pp = Text3.Text
QQ = Hex(pp)
If Len(QQ) = 3 Then
QQ = "0" & QQ
ElseIf Len(QQ) = 2 Then
QQ = "00" & QQ
ElseIf Len(QQ) = 1 Then
QQ = "000" & QQ
End If
str = "01061204" + QQ '传入D516,具有停电保护功能
LRCC = LRC(str)
strout = ":" + str + LRCC + Chr$(13) + Chr$(10)
MSComm1.InBufferCount = 0
MSComm1.Output = strout
Timer1.Enabled = True
End Sub