Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 27th, 2008, 05:48 PM
Registered User
 
Join Date: Jun 2006
Location: Richardton, ND, USA.
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,

Elias

Reply With Quote
  #2 (permalink)  
Old September 27th, 2008, 12:02 PM
Registered User
 
Join Date: Sep 2008
Location: charlotte, nc, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 08:09 PM



All times are GMT -4. The time now is 09:05 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.