borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (printing problems)Next Topic (Displaying Images) New Topic New Poll Post Reply
AndreaVB Forum : Printing : VB printing problem
Poster Message
Bill Schuller
Level: Guest


icon VB printing problem

I am writing a program to manage a data base.
I was able to set the font in the list box that showed the data in a columnized form.  But I meed to print six columns of data that is in nice column format.  But it prints on the paper in proportional space and I need it to be fixed pitch.

04-01-2003 at 04:27 AM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: VB printing problem

quote:
But it prints on the paper in proportional space and I need it to be fixed pitch.


what exactly do you mean by that?

is is that no matter how you align your columns, the printout doesn't come out the way you set it?

____________________________
Been busy trying to take a second degree <--it's not working out...
04-01-2003 at 07:52 AM
View Profile Send Email to User Show All Posts | Quote Reply
Bill Schuller
Level: Guest

icon Re: VB printing problem

A upper case W has a character width that is greater then a lower cse i. Therefore with spaces between columns the next column is not vertically aligned.  I have tried using tabs like below but after each tab the print goes to a new line.

Printer.Print Mid(Working_List(I - 1), _
          FIRST_NAME, 20); Tab(5); _
                      Mid(Working_List(I - 1), _
          LAST_NAME, 20); Tab(5); _
                      Mid(Working_List(I - 1), _
          Sex, 1); Tab(5); _
                      Mid(Working_List(I - 1), _
          Age, 2); Tab(5); _
                      Mid(Working_List(I - 1), _
          SCHOOL, 20); Tab(5); _
                      Mid(Working_List(I - 1), _

04-01-2003 at 02:47 PM
| Quote Reply
Shady
Level: VB Guru


Registered: 08-07-2002
Posts: 305
icon Re: VB printing problem

Hi Bill,

I too use VB6 to manage a database, and I have to print out various reports which are aligned in columns. Having looked at your example code, one thing seems wrong, and that is that each of your tabs are set at 5.  This means that you are trying to print each item five spaces from the left, which is probably why you get each piece of information on a new line.

Tabs have to be aggregated i.e. if your first item is to be printed 5 spaces in the first tab is TAB(5), if you then want the next item to be printed 5 spaces further on from the end of your first item you must add on the length of your second item and then add the five spaces for the tab.

Example
-------

1st item = Joe Bloggs
2nd item = Male
3rd item = High School

the first tab will be TAB(5)

the second tab must be about TAB(25), this is the first TAB(5) plus 15 spaces to allow for the name to be printed plus the next TAB(5).

This continues across the line you are printing, for instance the 3rd tab will be around TAB(40), this allows 10 spaces for the words MALE/FEMALE to be printed and then another 5 for the gap between this and the next item.

If you want to see what I mean paste this code under a button and try it out.

printer.print TAB(5) ; "Joe" ; TAB(15) ; "Male"; TAB(25) ;"High School"
printer.print TAB(5) ; "Fred" ; TAB(15) ; "Male"; TAB(25) ;"Primary School"
printer.enddoc

I know its very simple, but it may give you an idea on how to use your tabs properly.

NB: Depending on which font you use you may have to tinker with the tabs, but once you get them set up you should be laughing,  I personally use Times New Roman.

Hope this helps

Regards

Shady

____________________________
I don't wanna die... but I ain't keen on livin' either

07-01-2003 at 10:04 AM
View Profile Send Email to User Show All Posts | Quote Reply
Bill Schuller
Level: Guest

icon Re: VB printing problem

Thanks for your response.  You were right. I thought that tabs were relative from the print position but they are really absolute.  I did what you suggested and it was apparent what the problem was.

Thanks again

Bill Schuller

07-01-2003 at 02:39 PM
| Quote Reply
Shady
Level: VB Guru


Registered: 08-07-2002
Posts: 305
icon Re: VB printing problem

Glad to be of service       

____________________________
I don't wanna die... but I ain't keen on livin' either

07-01-2003 at 05:11 PM
View Profile Send Email to User Show All Posts | Quote Reply
buds
Level: Guest

icon Re: VB printing problem

Problem: I'll make a VB program in which the user inputs info into a textbox (es), then the info is printed out in a (already made)form.

For example:
Human Resources needs info about the applicants' name, address, phone, educational background, etc. The applicants will just type this info in a vb FORM (exe file), then hits the PRINT button and the info provided are printed out in a ready made (pre-printed)forms from the printer.

I would appreciate help/hints regarding this problem. If you have sample codes that you could share, that would be great.

Thanks,
buds

16-01-2003 at 01:04 AM
| Quote Reply
Shady
Level: VB Guru


Registered: 08-07-2002
Posts: 305
icon Re: VB printing problem

Hey Bud

Check your private messages, I've sent you one which may help.

Regards

Shady

____________________________
I don't wanna die... but I ain't keen on livin' either

17-01-2003 at 09:29 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : VB printing problem
Previous Topic (printing problems)Next Topic (Displaying Images) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder