Read data from rs232 port vb6.0

D

Thread Starter

Dotman

This topic was raised by a recent post http://www.control.com/1026175175/index_html. The following code found at http://support.microsoft.com/default.aspx?scid=kb;en-us;194922 was given as a solution.

My project involves wireless transmission using UHF Data Tranceiver modules. I have only started using Visual Basic. Would this code be suitable for transmitting data between the two modules connected to the serial ports? Would it be more suitable to use Java?

Any help would be greatly appreciated.....
 
You can very well use the MS Comm Control OCX. Use the following steps.

Include the control in the project.
Drag it to a VB form.
double click it and set its parameters like Baud Rate, Stop Hits, Number of bits, Etc.
Drag a command button in your form.
Type the following script in the form open event:

Me.Mscomm1.PortOpen = True

Type the following script into the click event of your command button:

Me.Mscomm1.Output = "the Data to be sent "

// you can read the data comming to your comm port through the mscomm event. the Property will be "input"
use the following script in the mscomm event to read the data
Dim ReadData as String
ReadData = Me.MsComm1.input
 
I don't understand quite how you drag the MSComm control into the VB form. In The control menu MSComm command is check marked but I can't bring it into a form, could someone further explain this, I'm new to VB.
 
If you've got a tick next to the MS Comm control under Project - Components, you should have an icon in the toolbox which looks like a telephone. Just click it once, then move the mouse over the form. Now hold down the left mouse button and drag a small distance (doesn't really matter how far), then let go of the mouse button. You should now have the control on your form.
 
Push Ctrl+T then Add MsComm from the list by check this, then "Apply", "OK".

From the toolbox, make Double click from MsComm, or drag this to Form.
 
Top