MSComm1.Output = Text1.Text
End Sub
Private Sub Command2_Click()
On Error GoTo err
CommonDialog1.Filter = "text files(*.txt)|*.txt"
CommonDialog1.DefaultExt = "txt"
CommonDialog1.ShowSave
Open CommonDialog1.FileName For Output As #1
Print #1, Text2.Text
Close #1
err:
End Sub
Private Sub Command3_Click()
Text2.Text = ""
End Sub
Private Sub Command4_Click()
Dim port As Integer
port = Val(Text3.Text)
If MSComm1.PortOpen = False Then
MSComm1.CommPort = port
MSComm1.RThreshold = 1
MSComm1.SThreshold = 0
MSComm1.DTREnable = True
MSComm1.RTSEnable = True
MSComm1.InputLen = 40
MSComm1.Settings =
Combo1.List(Combo1.ListIndex) & ",N,8,1"
MSComm1.PortOpen = True
Command4.Caption =
"Disconnect"
Command1.Enabled = True
Else
MSComm1.PortOpen = False
Command4.Caption = "Connect"
End If
End Sub
Private Sub Form_Load()
With Combo1
.AddItem "2400"
.AddItem "4800"
.AddItem "9600"
.AddItem
"19200"
.AddItem
"38400"
.AddItem
"56600"
End With
End Sub
Private Sub MSComm1_OnComm()
Dim buffer As String
Dim temp As String
buffer = MSComm1.Input
If buffer <> "" Then
With Text2
.SelStart = Len(.Text)
.SelText = buffer
End With
End If
End Sub
Tidak ada komentar:
Posting Komentar