

Private Sub Send(ATS)
MSComm1.Output = Text2.Text & vbCr
Text1.Text = Text1.Text & MSComm1.Input
End Sub
Private Sub Command1_Click()
With MSComm1
Send Text2.Text
End With
End Sub
Private Sub Form_Load()
Command1.Enabled = False
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Form_Resize()
Left = 0: Top = 0: Width = Screen.Width: Height = Screen.Height - 400
Caption = "Посылальщик Казахстанской Мобилы (ПКБ - Опер)"
With Text1
.Left = 100: .Top = 100
.Width = ScaleWidth - 200
.Height = ScaleHeight - Command1.Height - 200
End With
With Text2
.Left = Text1.Left: .Top = Text1.Height + 100
.Width = Text1.Width: Text2.Height = 50
End With
With Command1
.Caption = "Послать кого-то"
.Height = 500: .Width = ScaleWidth - 200
.Left = 100: .Top = Text1.Height + Text2.Height + .Height - (Text1.Top * 4)
End With
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
With MSComm1
If .PortOpen = True Then Exit Sub
For i = 1 To 5
.CommPort = i
.PortOpen = True
Caption = "попытка открытия порта 'COM" & i & "'"
If .PortOpen = True Then Exit For
Next i
If .PortOpen = False Then
Caption = "Порт не был открыт"
Else
Caption = "Порт 'COM" & i & "' открыт"
End If
'MsgBox Caption, vbInformation, ""
End With
If Command1.Enabled = False Then Command1.Enabled = True
End Sub
Сейчас этот форум просматривают: С.Т., Yandex-бот и гости: 3