|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

July 27th, 2008, 06:48 PM
|
|
Registered User
|
|
Join Date: Jun 2006
Location: Richardton, ND, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

September 27th, 2008, 01:02 PM
|
|
Registered User
|
|
Join Date: Sep 2008
Location: charlotte, nc, USA.
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.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |