
How to use Serial Port in VB 2010

Hello friends, I hope you are doing well. In this tutorial, we will build a simple serial terminal in Visual Basic 2010. The application will detect the COM ports available on a Windows computer, open a selected port, transmit text, receive incoming data and close the connection cleanly.
This article keeps Visual Basic 2010 because that is the environment used in the original project and screenshots. According to the official Microsoft lifecycle record, Visual Studio 2010 reached the end of support in July 2020, so you should use a supported Visual Studio and .NET version for a new production application. However, the serial communication principles explained here still apply to maintenance work, laboratory computers and older engineering projects.
We will begin with the electrical and protocol basics, create the Windows Forms interface, write the complete VB code and then test the terminal with a loopback connection. I will also explain why received data cannot be written directly to a Windows Forms control from the serial event handler.
What Is Serial Communication?
Serial communication transfers bits one after another over a communication channel. In a basic asynchronous UART link, one device transmits on its TX line and the other receives on its RX line. The devices normally share a ground reference. A full-duplex link uses separate TX and RX conductors, so both sides can transmit at the same time.
A COM port is the Windows name for a serial interface. A built-in RS-232 port, a USB-to-UART converter and some Bluetooth serial profiles can all appear as names such as COM3 or COM8. The name identifies the Windows port; it does not tell us the electrical voltage used by the attached hardware.
| Setting | Meaning | Value used here |
|---|---|---|
| Baud rate | Number of symbols transmitted per second | 9600 baud by default |
| Data bits | Payload bits in each frame | 8 |
| Parity | Optional error-detection bit | None |
| Stop bits | Marks the end of a frame | 1 |
| Handshake | Hardware or software flow control | None |
The common notation 9600 8N1 therefore means 9600 baud, eight data bits, no parity and one stop bit. A normal 8N1 character contains one start bit, eight data bits and one stop bit, which gives ten transmitted bits per byte. The ideal maximum payload rate is:
Payload rate = 9600 bits/s / 10 bits per byte = 960 bytes/s
This is a theoretical value before application delays and protocol overhead. Both endpoints must use matching settings. A mismatch may produce unreadable characters, incomplete messages or no useful data.
Check the Electrical Interface Before Connecting Hardware
A microcontroller UART commonly uses 3.3 V or 5 V logic, while a traditional computer RS-232 connector uses inverted positive and negative voltage levels. Do not connect a microcontroller UART directly to a DB9 RS-232 port. Use a suitable level translator, such as a MAX232 circuit, or a USB-to-UART adapter with the correct logic voltage.
For a three-wire UART connection, connect the adapter TX to the device RX, adapter RX to device TX and the grounds together. Check the device documentation before joining grounds when either circuit is mains-powered or otherwise isolated. The software cannot correct an unsafe or incompatible electrical connection.
Controls Used in the Visual Basic Serial Terminal
Our application uses the System.IO.Ports.SerialPort class. Microsoft documents this class as the interface for synchronous and event-driven I/O through a serial port. We will place a SerialPort component on the form so Visual Studio creates and disposes the component with the form.
Create the following controls. The Name property is the identifier used in code, while the Text property is the caption shown to the user.
| Control | Name property | Text or purpose |
|---|---|---|
| Form | frmMain | Serial Terminal |
| ComboBox | cmbPort | Available COM ports |
| ComboBox | cmbBaud | Baud-rate choices |
| Button | btnConnect | Connect |
| Button | btnDisconnect | Disconnect |
| TextBox | txtTransmit | Text to transmit |
| Button | btnSend | Send |
| RichTextBox | rtbReceived | Received text |
| SerialPort | SerialPort1 | Serial connection component |
Step 1: Create a Windows Forms Project
- Open Microsoft Visual Basic 2010 Express or Visual Studio 2010.
- Select File, New Project.
- Select Windows Forms Application under Visual Basic.
- Name the project SerialPortInterface and select OK.
The New Project dialog in your edition may look slightly different, but the application type must be a Visual Basic Windows Forms application.
Visual Studio creates a blank form and the files required for the project. The form is the visual surface on which we will place the terminal controls.
Step 2: Configure the Main Form
Select the form and open the Properties window. Change the (Name) property from Form1 to frmMain. Change its Text property to Serial Terminal. The name makes the form easy to identify in code, while the text appears in its title bar.
Step 3: Add Port and Baud-Rate Controls
Drag two ComboBox controls, two Button controls and two Label controls from the Toolbox to the form. Arrange them in a clear connection section.
- Name the first ComboBox
cmbPortand label it COM Port. - Name the second ComboBox
cmbBaudand label it Baud Rate. - Name the buttons
btnConnectandbtnDisconnect. Set their Text properties to Connect and Disconnect. - Set each ComboBox
DropDownStyletoDropDownListif you want the user to select only a detected or predefined value.
Visual Basic identifiers are normally case-insensitive, but spelling still matters. Using the exact names in the table ensures that the event handlers and references in our code point to the intended controls.
Step 4: Add Transmit and Receive Controls
Add two GroupBox controls. Set their Text properties to Transmit Data and Received Data. Put a TextBox named txtTransmit and a Button named btnSend inside the transmit group. Set the button text to Send. Put a RichTextBox named rtbReceived inside the receive group.
Finally, find SerialPort in the Components section of the Toolbox and drag it onto the form. It appears in the component tray below the designer because it has no visible user interface. Keep its name as SerialPort1. The code will set its communication properties before opening the port.
Step 5: Add the Visual Basic Code
Press F7 or right-click the form and select View Code. The code editor opens as shown below.
Replace the form class code with the following example. Leave the designer-generated file unchanged. This version handles an empty port list, validates the baud rate, reports common connection errors, marshals received data to the user-interface thread and closes the port when the form exits.
Imports System.IO
Imports System.IO.Ports
Public Class frmMain
Private Sub frmMain_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
cmbBaud.Items.AddRange(New Object() {"9600", "19200", "38400", "57600", "115200"})
cmbBaud.SelectedIndex = 0
RefreshPortList()
SetConnectedState(False)
End Sub
Private Sub RefreshPortList()
Dim ports() As String = SerialPort.GetPortNames()
Array.Sort(ports)
cmbPort.Items.Clear()
cmbPort.Items.AddRange(ports)
If cmbPort.Items.Count > 0 Then
cmbPort.SelectedIndex = 0
End If
End Sub
Private Sub btnConnect_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnConnect.Click
If cmbPort.SelectedItem Is Nothing Then
MessageBox.Show("No COM port is available. Connect the adapter and try again.")
Return
End If
Dim selectedBaud As Integer
If Not Integer.TryParse(cmbBaud.Text, selectedBaud) Then
MessageBox.Show("Select a valid baud rate.")
Return
End If
Try
SerialPort1.PortName = cmbPort.Text
SerialPort1.BaudRate = selectedBaud
SerialPort1.DataBits = 8
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.Handshake = Handshake.None
SerialPort1.Encoding = System.Text.Encoding.ASCII
SerialPort1.ReadTimeout = 1000
SerialPort1.WriteTimeout = 1000
SerialPort1.Open()
SetConnectedState(True)
Catch ex As UnauthorizedAccessException
MessageBox.Show("The port is already in use or access was denied.")
Catch ex As IOException
MessageBox.Show("Windows could not open the selected serial device.")
Catch ex As ArgumentException
MessageBox.Show("One or more serial-port settings are invalid.")
Catch ex As InvalidOperationException
MessageBox.Show("The serial port is already open.")
End Try
End Sub
Private Sub btnDisconnect_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnDisconnect.Click
CloseSerialPort()
End Sub
Private Sub btnSend_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSend.Click
If Not SerialPort1.IsOpen Then
MessageBox.Show("Connect to a COM port before sending data.")
Return
End If
Try
SerialPort1.Write(txtTransmit.Text)
Catch ex As TimeoutException
MessageBox.Show("The serial write operation timed out.")
Catch ex As InvalidOperationException
MessageBox.Show("The serial port is closed.")
SetConnectedState(False)
End Try
End Sub
Private Sub SerialPort1_DataReceived(ByVal sender As Object,
ByVal e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Try
Dim incoming As String = SerialPort1.ReadExisting()
If incoming.Length > 0 Then
rtbReceived.BeginInvoke(New Action(Of String)(AddressOf AppendReceivedText), incoming)
End If
Catch ex As InvalidOperationException
'The port may have been closed while the event was being processed.
End Try
End Sub
Private Sub AppendReceivedText(ByVal text As String)
rtbReceived.AppendText(text)
rtbReceived.SelectionStart = rtbReceived.TextLength
rtbReceived.ScrollToCaret()
End Sub
Private Sub SetConnectedState(ByVal connected As Boolean)
btnConnect.Enabled = Not connected
btnDisconnect.Enabled = connected
btnSend.Enabled = connected
cmbPort.Enabled = Not connected
cmbBaud.Enabled = Not connected
End Sub
Private Sub CloseSerialPort()
Try
If SerialPort1.IsOpen Then
SerialPort1.Close()
End If
Finally
SetConnectedState(False)
End Try
End Sub
Private Sub frmMain_FormClosing(ByVal sender As Object,
ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing
CloseSerialPort()
End Sub
End Class
The completed code editor should resemble the original project view below.
How the Serial Port Code Works
Discovering COM Ports
SerialPort.GetPortNames() returns the serial port names known to Windows. The order is not guaranteed, so the example sorts the array before placing it in cmbPort. It also checks whether the list contains an item. This avoids the out-of-range error that occurs when code selects item zero on a computer with no detected serial port.
Opening the Connection
The Connect handler copies the selected port name and baud rate to SerialPort1, explicitly sets the remaining 8N1 parameters and calls Open(). A serial port is an exclusive resource in most normal desktop use. If another terminal, programmer or instance of this application already owns it, Windows may reject the request with an access error.
Once the port opens, the program disables the port settings. Changing PortName, BaudRate or related properties while the port is open can raise an exception, and it can also make the interface state misleading.
Sending Text
SerialPort1.Write(txtTransmit.Text) transmits the entered characters without automatically appending a line ending. If the receiving device expects a command terminated by carriage return and line feed, set SerialPort1.NewLine = vbCrLf and use SerialPort1.WriteLine(txtTransmit.Text). Choose the terminator required by your protocol rather than assuming every device uses the same one.
The example uses ASCII encoding because it is common in simple embedded command protocols. If you need characters outside ASCII, both endpoints must agree on an encoding and on how message boundaries are identified. Binary protocols should use byte arrays and explicit lengths rather than converting arbitrary bytes to text.
Receiving Data on the Correct Thread
The DataReceived event runs on a secondary thread. Windows Forms controls belong to the thread that created them, so writing directly to rtbReceived from that event can cause a cross-thread exception. Microsoft therefore requires the update to be marshalled to the form thread through Invoke or BeginInvoke.
Our event handler reads the characters currently available through ReadExisting() and passes the resulting string to AppendReceivedText with BeginInvoke. The helper then runs on the user-interface thread and safely appends the text. The event is not guaranteed to occur once for every complete message or every byte, so a real protocol must accumulate data until it finds a delimiter, fixed length or another complete-frame condition.
Step 6: Build and Run the Project
- Select Build, Build SerialPortInterface.
- Correct any compiler errors, paying close attention to control names.
- Press F5 to start the application under the debugger.
- Select the correct COM port and the same baud rate used by the attached device.
- Select Connect, enter a short test message and select Send.
The build command creates the executable as part of the project output. During development, you normally run the Debug build from a path similar to bin\Debug. A deployment package is a separate concern; copying only the executable may be insufficient if an application has additional files or framework requirements.
Test the Terminal with a Loopback
A loopback test is the simplest way to separate a PC software problem from a remote-device problem. On a compatible USB-to-UART adapter, disconnect external circuitry and join the adapter TX pin to its RX pin. Do not short a conventional RS-232 connector until you have identified the correct pins and interface type.
- Insert the adapter and note the COM port assigned by Windows Device Manager.
- Start the application and select that port.
- Select 9600 baud and connect.
- Enter a distinctive message such as
Loopback 123. - Select Send. The same text should appear in the received-data box.
If the text returns correctly, Windows, the adapter, the COM-port settings and the main send/receive path are working together. Remove the loopback wire before connecting the target device.
Common Serial Port Problems
| Symptom | Likely cause | What to check |
|---|---|---|
| No COM ports appear | Adapter is disconnected or its driver is unavailable | Check Device Manager, reconnect the adapter, then restart or add a refresh-port button |
| Access denied when connecting | Another program has opened the port | Close other terminals, debuggers and duplicate application instances |
| Unreadable characters | Baud rate, parity, data bits or stop bits do not match | Set both endpoints to the same complete frame format |
| Transmission works only one way | TX and RX wiring is incorrect or a common ground is missing | Cross TX with RX and verify the electrical interface |
| Received text arrives in pieces | Serial data is a stream and event boundaries are not message boundaries | Buffer data and parse it using the protocol delimiter or expected length |
| Device ignores a typed command | Required line ending was not sent | Use the documented terminator and WriteLine when appropriate |
| Cross-thread operation error | The receive event updated a form control directly | Use Invoke or BeginInvoke to update the UI |
| Application remains connected after closing | The port was not closed during shutdown | Close it in the form-closing event as shown above |
Practical Review
We created a Visual Basic Windows Forms serial terminal that enumerates COM ports, configures an 8N1 link, transmits text and displays received data. The most important design detail is the separation between the serial receive thread and the user-interface thread. Once you understand that boundary, you can extend this project with timestamps, a clear button, hexadecimal display, file logging or a protocol parser.
Keep the protocol separate from the graphical interface as the project grows. For example, a line-oriented sensor can buffer characters until it receives a newline, while a binary device may use a header, length field, payload and checksum. A visible chunk in DataReceived should never be assumed to equal one complete application message.
Frequently Asked Questions
Can I use this code with Visual Studio 2022 or a newer release?
The same concepts apply, but the project target and package requirements may differ. For a new application, create a supported Visual Basic Windows Forms project and consult the current System.IO.Ports documentation. The screenshots and designer workflow in this tutorial specifically show Visual Studio 2010.
Why does my COM port number change?
Windows assigns COM-port names to detected devices and interfaces. Moving some USB adapters to another socket, reinstalling a driver or using a different adapter can produce a different number. Select the port shown for your device in Device Manager rather than hard-coding COM1.
Should I use Write or WriteLine?
Use Write when the protocol expects exactly the supplied characters or bytes. Use WriteLine when the receiver expects a line terminator, and set the NewLine property to the required sequence. The choice belongs to the device protocol.
Why does DataReceived return only part of a message?
A serial port delivers a byte stream. Operating-system buffering, device timing and event scheduling determine how many characters are available during a particular event. Store incoming data in a buffer and extract messages only after the protocol's completion condition is present.
Can this terminal receive binary data?
Yes, but ReadExisting() is intended for decoded text. For binary communication, read bytes, preserve their exact values and implement the framing rules defined by the device protocol. Avoid mixing text and binary reads without a clear boundary.
Do I need hardware flow control?
Not for the simple three-wire example. Some modems and high-throughput devices require RTS/CTS hardware control or XON/XOFF software control. Set the Handshake property to match the equipment documentation; enabling it on only one side can stop transmission.
Why should the port be closed when the form exits?
Closing releases the Windows handle and allows another program to use the device. It also reduces the chance that a late receive event will try to interact with controls while the form is being destroyed.
You now have a useful foundation for PC-to-microcontroller communication in Visual Basic. Test the software with a loopback first, match all serial settings at both ends and then add your device-specific commands one step at a time.
saim_lodhi89@hotmail.com
this is my id please send the code to my email id
i have subscribed to the newsletter really need this one
thanks in advance
@kashif Thanks bro for appreciation and yups try it and let me know howz you find it.
@Seol This Invoke function is used actually to automatically called every time a data is received at the Serial Port. Its kind of an interrupt for the coming data.
@saim lodhi The code and the software has been sent bro, check your email id. and stay connected ... :))
thnx bro file received
2 replies
you are welcome bro ....
I'm having same issue if u resolve u r then plz help me.
Kindly mail me the code and software. I have subscribed to your mailing list.
this is my mailing list gopsi1234@gmail.com
1 reply
A mail with the title "Serial Terminal" has been sent to you .... If you still have any problem please ask in comments and let us resolve your issues .... Thanks.
Hello,
I have problem with this. SerialPort1 is not declared
1 reply
Check the last line of Step4 ..... " Lastly and i think its the most important part of this tutorial, add a Serial Port Block into your forum. It will appear at the bottom. Don't change any of its parameters just leave it as it is."
I think you didn't add the serial port block in your project that's what causing problem and if you have added then make sure the name of your serial port block is SerialPort1 .... you can change it in the properties.
1 reply
I also did same mistake. Now corrected it. But facing another problem... Com port sends data( led on usb converter blinked) but is not received on hyperterminal.. Also from other side if i send some data then vb application is not receiving data
Awesome tutorial. Much appreciated.
1 reply
Thanks for appreciation bro .... :))
Thank you very much! I will use you code for base to create a new one.
Good work!
Grettings
1 reply
Thanks for the appreciation bro .... :))
Cheers !!!
Hi,
my name is Laurentiu and just joined the site today. I am also interested to obtain the above code. Could you please sent it to me at: vj_lau@yahoo.com
Many thanks in advance !!!
1 reply
I have sent the email on the provided email ID .... Kindly follow the instructions in the mail.
Thanks.
I'm have a problem: When I start your program there are no ports in the pulldown. I have tried using the 'myPort = IO.Ports.SerialPort.GetPortNames()' before without getting any ports.
Could this be computer related?
3 replies
Before running the project .... make sure that you have connected the COM Port with your computer .... As it automatically detects all the ports so if there's no port already available then it creates problem.
Moreover, have you changed the name of Form1 to frmMain ? Double check it.
If still having problem, let me know.
No change. Will it detect virtual serial ports via usb when there is no actual serial port on the computer?
Yeah it will detect that usb port .... I think you are using serial to usb converter .... make sure that you have installed the drivers correctly and some COM has been assigned to your cable like COM3 etc ....
The best way to test the software is via virtual port .... the port you are taking is not virtual .... virtual is actually a software port which doesn't exist but operates virtually (software level) ...
hello i am jashwanth My email ID is jashwanthreddy09@gmail.com
Can you please send me the code . I need it urgently.
1 reply
Hi bro, We couldn't find your your email in our subscriber list .... Kindly subscribe to us and the files will emailed to you .... Thanks.
Hi. Can i ask something. I already follow all your instructions. I can debug the code. But when i click on Connect button, error message popup stated that "UnauthorizedAccessException was unhandled. Access to the port 'COM4' is denied. It is because i used virtual serial port? I used proteus, eltima virtual serial port and microc pro for PIC.
3 replies
Hello, the problem is Proteus doesn't support virtual serial port .... It once happens to me as well .... try this software independently via hardware ....
Thanks.
Now i have another problem. It stated that i have no permission or the file is read only. My email kay.own90@gmail.com
Your id is not appearing in our subscription list .... Subscribe to our newsletter and the complete project will be forward to you ....
Thanks.
Hello nasir,
i am vishnu,i have subscribed would please send me the code my mail id:-vishnu471@gmail.com.
Thanks
1 reply
Hi bro,
Thanks for subscribing to our newsletter. I have emailed you the complete project.
Thanks.
Hi bro,
i am using visual studio 2010 c++,i have try to made terminal using c++ windows form applications.i tried run exe file on other pc which don't have studio it showing errors.i changed the settings project->properties-> cofiguration->c++->codegeneration->multi threaded(mt). after changing settings also i'm getting errors.what is the solution for this? give reply asap.
thanks
1 reply
Actually such applications need .NET Framework so make sure that the other computer has it ...
Hi Nasir,
I have got this problem as below,
The PortName cannot be empty.
Parameter name: PortName
The list of com port does not drop down as well. It is blank when I run the program. I really appreciate your help.
Regards,
Teh
1 reply
Hi,
Actually you are getting the problem because you haven't attached any COM Port with the computer on which you are running it .....
So, before running this software first attach some COM Port or create a virtual COM Port.
Thanks.
Hi,
My name is Nimal Rathnaweera and just joined the site today. I am also interested to obtain the above code. Could you please sent it to me at: nratnaweera@gmail.com
Many thanks in advance !!!
Nimal
1 reply
Code has been sent to given email id .... If you couldn't find it then check your trash folder.
Thanks.
hii
i want .exe file for above mentioned terminal. my email id is pardeep_acet74@yahoo.com.
i want to receive data sent from my micro controller unit to system via serial port db9. and the sore in the data base of system in excel file or in other former..
plz help
thanks..
hii
i want .exe file for above mentioned terminal. my email id is pardeep_acet74@yahoo.com.
i want to receive data sent from my micro controller unit to system via serial port db9. and the store in the data base of system in excel file or in other formet..
plz help
thanks..
Hi
Sir I follow the procedure and make the program and compile it successfully, but before that i miss to rename the transmit text box, however after compiling the program i start the program but it does not shows any thing in combo box nor port no neither baud rate, i also try virtual serial port but it does not works, i repast the whole code again and i got an error and form in design tab also vanishes.
I just forget the what error was because while writing this i repast and test it, and it works launch the program it works, i wonder what happens, Its like charm , Can u explain what happened, first it does not work but later it works
1 reply
change this code
myPort = IO.Ports.SerialPort.GetPortNames()
to
myPort = SerialPort.GetPortNames()
Also the transmit is not included Character return and line feed...so if you are using modem it doesn't work.
Please add the character return yourself. ....I am testing the receiving part, since I can get message response
1 reply
I'm not able to receive if u can help me plz.
This is really pretty cool, i compiled and controlled Arduino succesifully. But make sure the port is short circuited/or there is handshake between the transmitter and the receiver in order to see how it send as well as it receive data.
I have tried code using VB2010 on Windows 7, the program runs perfectly without any error BUT its NOT detecting any serial/com ports on my machine. Checking the Device Manager, under (PORTS & LPT) communication port (COM1) is listed there.
What do I missed?
Please help.
Thanks
It doesnt work in Visual Studio 2012 :( any thoughts why?
1 reply
You must be doing some mistake , let me know what error you are receiving?
Hello can you please send me the project?
1 reply
Bro it's for sale now, you can find its modified version in our shop.
Hi Syed Zain Nasir,
This is a very interesting tutorial/project. for learning purposes, can I have a copy of this project? thanks! my email add is akatoybits@hotmail.com
Thanks,
Albert
This is a very interesting tutorial/project. for learning purposes, can I have a copy of this project? thanks! my email add is ddprasad [at] gmail [dot] com
Thanks,
Muchas gracias, me sirvió bastante tu explicación.
1 reply
English please :P
Hi Im working with FT232r
After I finished your tutorial and Implement it with Visual basic All the section except Received field work currently
I shortened Rx and Tx pins of Ft232r but What I sent through "Send button did not appear In Received Field
Both Received and Transmit LED on FT232r module became on when I sent my string but why I couldn't see any string in Received Text?
Thanks in advance
1 reply
You must be making some mistake.
Sir I Using PLC With Port Connection, But When I Connect Using COM1 The Device Connection Is Off.., When I Closed Connection, Device Connection Is On...
Why...??
Can You Give me Solution..??
Thankyou...
1 reply
Hi,
No idea here,it seems like the port is using at two different places, I think any other program also accessing the port. Can't say anything for sure.
Thanks.
Hi, i am jack. i have subscribed. can u please send me the code. my email address is crogerjack@gmail.com.
Thanks.
1 reply
Hi,
The simple code is attached in this post and if you need its advanced for then you need to buy it from our site.
Thanks.
sir i need the code..can u please send the codes to kdeven7@gmail.com.thank u..:)
1 reply
The code is for sale, you can get it just for $10.
Thanks.
Hi, can this program display data send from a Bluetooth low energy device in window 8.1?
1 reply
Yeah it can, you need to select the Com port of your bt device in this software and it will start receiving data
I compiled this code fine. Connect it to an Arduino board project.
On initial connection there seems to be trash characters being sent to the Arduino. After about 3 or 4 seconds it stops. Happens every time the connection is established. After that it works great.
Any ideas what might cause such a thing? I have not modified the code in any way.
This behaviour does not happen if I connect with Putty to the Arduino board.
2 replies
The code has been updated. Now it will work fine :)
This code works perfectly fine. You must be doing some mistake. Debug it and understand it and you will find the solution.
tanmaychauk17@gmail.com
Hello sir,
This is very nice and useful for me. I want vb code. Could you send me code? This is my GMAIL ID: pazhanibond@gmail.com
1 reply
Hi
You can buy the complete project with code from shop.
Thanks.
Hi. I tried this code. The data gets transmit but it is not received in Received Text Box.
Yes its working sir. Thank u.
I want to create this form...can you tell me what will be the code?? How can i store the data coming from usb??
Sorry my last comment was incomplete.. I am sending a pic to you.. I want to create this form.. Can you tell me what will be code?? How can I store data coming from usb??
Hi, I am David. I have subscribed. can u please send me the code. my email address is lord_oilboy@hotmail.com
Thanks.
hi sir..can u send me source code
1 reply
You can buy this project from our shop for $5.
Sir,
How to make this program in java?
How to rx & tx data through JAVA application?
may you please send me the logic and code?
sir this code can communication with GSM modem? i try this code but didnt show receive data? thanks
1 reply
Hi,
No this code won't work with GSM. Its just a COM Port code. If you wanna work on GSM then add me on Skype and I will help you out. My Skype id is theenggprojects.
Thanks.
I get an error on this line:
cmbPort.Items.Add(myPort(i))
Because option stric on disallows late binding.
Any solution for that?
Hi Syed, liked your tutorial, I did everything you said, but the comm port drop down box is empty, does not pick up any ports and there are definetly ports open on my PC , I can open them with Hyper terminal or Clear terminal, I use Windows7, what can be the problem?
Willie
Good morning
could you please send me your tutorial " How to use Serial Port in VB 2010" program ?
Thank you.
Angelo.
actually i want to send command from visual studio to xbee and receive data comming on serial port i need code for this purpose , i dont want to use ardujino for decrypt the receive string , i have to do all operation from visual studio related xbee please help me out ..
thanks ....
where this code will come ?
and how to get SerialPortInterface that is the third tab
( Serial Port Receiving Code Starts Here ....
Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
ReceivedText(SerialPort1.ReadExisting())
End Sub
'Serial Port Receiving Code Ends Here ....
'Serial Port Receiving Code(Invoke) Starts Here ....
Private Sub ReceivedText(ByVal [text] As String)
If Me.rtbReceived.InvokeRequired Then
Dim x As New SetTextCallback(AddressOf ReceivedText)
Me.Invoke(x, New Object() {(text)})
Else
Me.rtbReceived.Text &= [text]
End If
End Sub
'Serial Port Receiving Code(Invoke) Ends Here ....
'Com Port Change Warning Code Starts Here ....
Private Sub cmbPort_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPort.SelectedIndexChanged
If SerialPort1.IsOpen = False Then
SerialPort1.PortName = cmbPort.Text
Else
MsgBox("Valid only if port is Closed", vbCritical)
End If
End Sub )
Send me please the code to my mail aliessajaffar@gmail.com
1 reply
Plesso send me The code
maurizio.moris@aruba.it
Ty Very much
1 reply
No replay Witherspoon code?
























Comments
95