Printing a simple plain text string

Zarneth

New member
Joined
Aug 19, 2005
Messages
3
Programming Experience
1-3
When my friend asked me to whip up a simple 50 line program I said "Sure, that'll take no time at all"
A couple of hours later I'm literally banging my head on the desk. Why do microsoft have to make things so complicated?

All I want to do is send some plain raw text to the deafult printer. No print preview, no fancy noncence. The most complicated thing I'll be sending is new line characters. (It's a small reciept printer and only supports plain text too)

Does anyone know how to send a simple text string to the printer? Or would I be better deleting .net and digging out VB6?

Thanks.
 
ayozzhero said:
I personally think that printing in VB .Net is powerful. However, we should know the basic concept in programming is: with great power comes great difficulty :)

Since what you want is just a simple text printing, why not take a look at this: http://www.vbdotnetheaven.com/Code/Jun2003/2087.asp

Hope this helps.

Are you sure there's no easier way? The program this is for is easily under 50 short lines.
In VB6 I can print a string with only about 5 VERY short lines of code. And that's still not in raw text so may not be compatable with the reciept printer.

I'm thinking it might be easier (and more likly to suceed) if I make the program generate and run a batch file that does the printing. XP

Thanks anyway.
 
add a PrintDocument to the form (it'll be added to the component tray at the bottom of the form designer window) and double click on it now simply add:
e.Graphics.DrawString("String to be printed", FontPrintedIn, Brushes.Black, 0, 0)'First zero is for X axis, second is Y axis

and to actually print it use the .Print() method of the PrintDocument
 
JuggaloBrotha said:
add a PrintDocument to the form (it'll be added to the component tray at the bottom of the form designer window) and double click on it now simply add:
e.Graphics.DrawString("String to be printed", FontPrintedIn, Brushes.Black, 0, 0)'First zero is for X axis, second is Y axis

and to actually print it use the .Print() method of the PrintDocument

Thankyou. You are a god. (I just have to reinstall VB.net now. XP)

Seriously though why must people bloat their tutorials and examples so much? Now I know what code is actuially REQUIRED it's not too hard to see how the other tutorials work.
 
Back
Top