Home > Software engineering >  VB, serial communication to send data
VB, serial communication to send data

Time:10-03

I beginner VB programming, and now want to realize the serial communication, know is using MSComm control, program will not, however, the great god answers, light my passion of programming, thank you!
I found an example, the program debugging success, but the result is not correct, the program is as follows:
Public Class Form1

Private Sub Button1_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles for. Click
MPort=Me.AxMSComm1.Com ComboBox1. Text
AxMSComm1. DTREnable=True "open the serial port
"For the Enabled=False
End Sub

Private Sub Button2_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles Button2. Click
AxMSComm1. The Output=TextBox1. Text "send data"
MsgBox (" data sent successfully ")
End Sub

Private Sub Button3_Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles Button3. Click
TextBox2. Text=AxMSComm1. Input "receiving data"
MsgBox (" data reception success ")
End Sub

Private Sub Form1_Load (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles MyBase. Load

ComboBox1. Text=1 "the default serial number is 1"
End Sub
The End of the Class

Now run the program, click open the serial port, and then the cursor in "send data box", input data, such as the alphabet, click send data button, the pop-up as shown:

What to do, the great god answers, be urgent!

CodePudding user response:

LZ may refer to http://download.csdn.net/detail/zdingyun/1070246 under the link example of engineering.