Wrox Programmer Forums
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 27th, 2008, 05:48 PM
Registered User
Join Date: Jun 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Printing from VB 2008

I am a long time VB6 programmer of very modest ability, and I tend to write programs that manipulate a database. I have developed a module that allows me to print a page, but can find no equivalent in VB 2008, and my module will not translate automatically.

When printing I want to position fields and strings in various places about the page until I have the document I want, and then I send it to the printer.

My module works something like this:

Call PrnLine(font,size,attribute,x_location,y_location, txtString)

And it does just what I asked it to do. I repeat this call until my entire page is formatted, and then I send it to the printer.

The syntax to write this in 2008 fully escapes me, and there are so many more options and things to set up that for my last project I simply wimped out and went back to VB6.

Perhaps someone knows how to do what I want to do?
Perhaps someone can clue me in on how to write a single string in exactly the place that I want it to be on a page, and I can figure out the rest from there.

Thanks for your help,


Old September 27th, 2008, 12:02 PM
Registered User
Join Date: Sep 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

Having been a classic VB6 programmer (all the way back to version 3!) myself, this is a pretty common problem. And, if you are still using VB6 (which I do occasionally also), you should try to get the habit of using Class modules and that will help you get into the OO train of thought. Without learning about OO and how it works with VB now, you won't be a very productive person unless you stick with the old VB, and even then you won't be able to compete with those who have learned the "new" way of VB programming. Not trying to lecture, just giving out real world experience advice.

Alright, having said that, the scenario you describe would be a great candidate for using Crystal Reports, or any of a number of decent reporting packages. If you have VS2008, you can use Crystal Reports to make unbelievable beautiful printed reports, and in fact that is the whole purpose of the program. Check it out, if you have it, and if not, look around for other reporting software. If you have Office and Access, you could also use an Access report to do the printing part, and even hide the details from a user (who, unfortunately, will need Access or some other way to open the report.

Trust me when I say, using reporting tools is much, much easier in the long run than hand-coding a bunch of formatting instructions. I can remember doing that kind of thing back in the GWBASIC and QBASIC days, as there wasn't any other way. Now there is, and you will thank yourself for learning it.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning VB 2008 mhccStudent Visual Basic 2008 Essentials 1 September 22nd, 2009 06:06 PM
vb 2008 exsp Dracitus Visual Basic 2008 Professionals 2 September 27th, 2008 10:56 AM
why buy vs-2008 instead of vb-2008 jerryham VB.NET 7 September 2nd, 2008 02:39 PM
How do I write this vb 6 code to work in vb 2008? sanderson Visual Basic 2008 Essentials 3 June 10th, 2008 01:46 PM
VB 2008 Wrox Articles jminatel Visual Basic 2008 Professionals 0 February 8th, 2008 09:09 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.