Link to home
Start Free TrialLog in
Avatar of Mr_Fulano
Mr_FulanoFlag for United States of America

asked on

Line spacing and printing

Hi, I'm using VB.NET2010, WinForms. I have multiple lines of text that I append to a textbox's text property and then I print the textbox in its entirety.

Is there a way to space between words so that don't have to use spaces like this "       ", or tabs like "vbTAB". I found that both give strange results when printing.

Is there a way to say print this word and then move 10 spaces to the right and then print the next word...etc.

So, rather than saying

....+"Vehicles" + "            " + "Drivers" + "          " + "Mileage"....

or

....+"Vehicles" + vbTAB + "Drivers" + vbTAB + "Mileage"....

I'd like to say something like

....+"Vehicles" + 10_SPACES + "Drivers" + 17_SPACES + "Mileage"....

Any suggestions?

Thanks,
Fulano
ASKER CERTIFIED SOLUTION
Avatar of SudhiDesh
SudhiDesh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nasir Razzaq
>I found that both give strange results when printing.
The reason for that is that you are not using a fixed width font. When you use a fixed width font, each character, including space, takes the same amount of space so the spacing works as expected. With other fonts, different characters have different width so spacing does not work.

Avatar of Mr_Fulano

ASKER

Hi CodeCruiser, I was using Courier 8. I was under the impression that Courier was a fixed width font. If not, what should I use instead?

Thanks,
Fulano
Well Courier seems to be a fixed width font but then you should not get the spacing problems.

http://www.cfcl.com/vlb/h/fontmono.html
Hi,

You have mentioned, "then I print the textbox in its entirety".
Could you share the code you have written?  Will be able to get a better picture.
Thank you...this worked well for what I needed to do.
Thanks for the link CodeCruiser. Its something good to have.

Fulano