By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,156 Members | 1,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,156 IT Pros & Developers. It's quick & easy.

COM in VB

P: 49
Hi to all

where the COM concepts are utilized. Give me an example/ site on COM. Please.
Sep 11 '07 #1
Share this Question
Share on Google+
1 Reply


Robbie
100+
P: 180
I don't know a site about com-port control on VB6, however I've written a program which uses it as the 'gateway' to controlling a robotic arm.

The program itself is much too unnecessarily complex for just an example, but here are a few bits of code from it.

You need to add the component Microsoft Comm Control.
Add one of this control to your form and call it CommStuff for these examples. Remember that you can set up settings such as Baud Rate in the designer, in the object's properties (you don't have to do it through code).

First thing you need to do is open the port:
CommStuff.PortOpen = True

To send a string, simply do this:
CommStuff.Output = "Here's stuff which I'm sending"

If you want to receive a string (probably do this regularly to see if you have any text waiting to be read), store the value of Input:
ReceivedStuff = CommStuff.Input

After you access CommStuff.Input like that above, CommStuff.Input will now be blank. So you need to count on the variable which you stored it in - ReceivedStuff - from then on.

They are the basics of sending/receiving.
Sep 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.