Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text output to LPT/COM

Status
Not open for further replies.

ribsa3

Programmer
Jun 17, 2003
56
Hi there

I am just tinkering with VB.NET and would like to send unformatted text to a COM or LPT port.

So I am hoping someone could give me a little hint or a sample on how I best can do that (e.g. write the contents of a textbox to COM1). Also, if I there are any escape characters I should be aware of for start, end, linespace, form feed or other things.

Many thanks in advance!
Kindly,

Bjoern Sandvik

--------------------------------------------------------------------
He who asks is a fool for five minutes, but he who does not ask remains a fool forever.
-Chinese proverb
 
This should get you started:

Code:
        Dim portnum As Integer
        FileOpen(1, "LPT" & CStr(portnum), OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.LockReadWrite, -1)

portnum should be 1 through 16. Replace LPT with COM as needed.

What are you building? A spooler?

__________________________________________
Try forum1391 for lively discussions
 
Hi, and thanks for the tip

I'm trying to create a bypass solution for an application which by default only generates graphical print jobs. The target is a label printer which is very sensitive to non-ascii characters.

So ideally, my application retrieves data from a database and sends it directly to LPT or COM.

A sample string containing article number, name and quantity:
801-B01|FOLIO STORAGE, MONTHLY|12.00

More information than you'd want I guess, but you get the idea

-B

--------------------------------------------------------------------
He who asks is a fool for five minutes, but he who does not ask remains a fool forever.
-Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top