COM in VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jayachandra
    New Member
    • Mar 2007
    • 49

    COM in VB

    Hi to all

    where the COM concepts are utilized. Give me an example/ site on COM. Please.
  • Robbie
    New Member
    • Mar 2007
    • 180

    #2
    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.PortO pen = True

    To send a string, simply do this:
    CommStuff.Outpu t = "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.

    Comment

    Working...