Dim WithEvents SP As New IO.Ports.SerialPort Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load SP.PortName = "COM1" SP.BaudRate = 9600 SP.Parity = IO.Ports.Parity.None SP.StopBits = IO.Ports.StopBits.One SP.DataBits = 8 SP.DtrEnable = True SP.RtsEnable = True SP.Encoding = System.Text.Encoding.ASCII SP.Handshake = IO.Ports.Handshake.None End Sub Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click Try SP.Write(txtCommand.Text & Chr(13)) txtCommand.Text = String.Empty Catch ex As Exception MsgBox(ex.ToString) End Try End Sub Private Sub btnFEP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFEP.Click 'Send A FEP 01,X25 Command Dim str As String = "FEP 01,X25" SP.Write(str & Chr(13)) End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)