473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Formatting string with space function

Hi,

I'm using VB 2005 and I have a problem formatting a string when I use the print preview dialog box. I'm using just the vbCrLf character and the Space function to correctly align my data and when I write this data to a textfile, it's formatted the way I want it to be. But when I display it with the print preview dialog, the format is wrong.

I was able to trace the problem to either the Space function or the font. When writing to a file, no font was specified but in the print preview, I used Times New Roman. Also, the space function seems to be returning a white space that is shorter than one character....I'm not really sure about the last part.

Can someone help me out with this?

Preethi
Aug 3 '07 #1
3 1472
Plater
7,872 Expert 4TB
In most fonts, different characters have different widths.
For example in this reply box:
aaaa
----
Each line contains 4 characters (4 'a's and 4 '-'s) but they are different lengths.
If you use a terminal-type font, all the characters are the same width, but they look funny.

I'm not sure what you can do to solve your problem, but it's probably the difference in whatever default font is used when you view it (like notepad is times new roman I think)
Aug 3 '07 #2
Thanks for your help!

You're right. I think that's what's going on. Is there a different way to align strings to get the same result or do you think I should consider changing the font to something that is like the terminal-type font?

Preethi
Aug 3 '07 #3
Nevermind, I figured it out.
Aug 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Pascal | last post by:
Hello, I've a float number 123456789.01 and, I'de like to format it like this "123 456 789.01". Is this possible with % character?
11
by: Steve Holden | last post by:
I was messing about with formatting and realized that the right kind of object could quite easily tell me exactly what accesses are made to the mapping in a string % mapping operation. This is a...
2
by: Ken Wilson | last post by:
I am writing and .xml file and am not getting the formatting I would like. The portion of the code that is giving me problems is as follows; XmlTextWriter tw = new XmlTextWriter(filename); ...
4
by: hope | last post by:
Hi, How can I format a string field using Data Formatting Expression property in datagrid? For example: format last name from BROWN to Brown. Thanks
3
by: washoetech | last post by:
I have a gridview control. In this grid view there is a column for the price of an item. Some of the prices have a dollar sign in front of it and some dont. How do I get rid of the dollar sign...
8
by: Vinay Jain | last post by:
Hi.. I am newbe in postgresql so please help me though the question may be very easy to answer.. Is there any formatting function to get output with fix lengths..for example my query is.. schema...
25
by: mdh | last post by:
Hi Group, Not looking for an answer, but more of an explanation. Thinking back to those heady days when you had the time to do them, may I ask this. Exercise 1-22 asks for a program to "fold"...
11
by: Dustan | last post by:
Is there any builtin function or module with a function similar to my made-up, not-written deformat function as follows? I can't imagine it would be too easy to write, but possible... 'I am...
2
by: dmk | last post by:
Hi Again, I am reading a document into a page and then displaying it as source code (this is for an assignment.) I feel that the output that I am getting is a little hard to read, and want to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.