Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Line spacing and printing

Posted on 2011-04-19
8
Medium Priority
?
448 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:Mr_Fulano
  • 3
  • 3
  • 2
8 Comments
 
LVL 1

Accepted Solution

by:
SudhiDesh earned 2000 total points
ID: 35430598
Use Space(5)  where 5 represents the number of spaces to display.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35431287
>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.

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35431295
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Mr_Fulano
ID: 35438248
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
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35438917
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
0
 
LVL 1

Expert Comment

by:SudhiDesh
ID: 35441540
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.
0
 

Author Closing Comment

by:Mr_Fulano
ID: 35446046
Thank you...this worked well for what I needed to do.
0
 

Author Comment

by:Mr_Fulano
ID: 35446049
Thanks for the link CodeCruiser. Its something good to have.

Fulano
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question