Problem solve Get help with specific problems with your technologies, process and projects.

How can I print text or numbers with rectangles around them?

I am a VB.NET newbie and I am reading a lot of books on the subject. Printing is my biggest hurdle right now. Many of the "newbie" books on VB.NET don't cover printing at all. Others cover it in a very cursory fashion. I have not been able to find one that will cover what I want to know.

Here is what I need to get me started. Given a string variable with some text "Here is some text." How would you print that on a printer with a rectangular box around it? What I am trying to do is print some forms (not Windows VB forms, but document forms). Is it possible to give a short code snippet that would illustrate printing text or numbers with rectangles around them?
Isn't it funny that there are almost no articles on printing? In the Win32 C/C++ world, the only book I remember discussing printing was Charles Petzold's Programming Windows. Yet again, Charles' Programming C# book is the only one I know of that discusses printing.

The good news is that printing has gotten infinitely easier with .NET. In fact, there's a sample on the MSDN that does nearly what you want. Search for the string "Creating Standard Windows Forms Print Jobs" to see the magic of handling the PrintPage event handler.

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.