• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

COM

I have a device that is attached to my COM2.  How do I use VB to sends commands to operate the device?  I have commands instruction to operate it but I dont have any driver for it.  Can I send commands to the device without driver?  If yes, how?
0
cdloves
Asked:
cdloves
  • 2
1 Solution
 
samopalCommented:
Put MSComm Control on your form.
In code:

Const Baud = "38400"
Const Port = "Com1:"
Const DataBit = "7"
Const Parity = "Odd"
Const FlowControl = 1

'Open port
    MSComm1.CommPort = Val(Mid(Port, 4, 1))              
    MSComm1.Settings = Baud & "," & Format(Left(Parity, 1), "<") & _
                "," & DataBit & "," & FlowControl
    MSComm1.OutBufferSize = 512
    MSComm1.PortOpen = True

    OpenPort = MSComm1.PortOpen

'If port open, then send your string
if OpenPort = True then
        MSComm1.Output = MyStr
end if

'Close port
    MSComm1.PortOpen = False


HTH
0
 
cdlovesAuthor Commented:
Excellent...

I have another question if you would answer...how do I choose to print to the printer that is not a default printer?

You dont have to answer this....

Thanks
0
 
samopalCommented:
Sorry, I don't know how to print on non-default printer without it's selecting. But I saw a discussion about it 3-5 days ago.
Usually I'm using CommonDialog.ShowPrinter to select a destination printer
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now