 |
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
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 |
|
|
Bill Schuller Level: Guest

|
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 |
|
|  |
|
|
Shady Level: VB Guru

 Registered: 08-07-2002 Posts: 305
|
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 |
|
|
|
|
 |
 |