473,386 Members | 1,842 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,386 software developers and data experts.

Print Using

Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please tell
me what I'm not seeing!
Nov 21 '05 #1
8 2201
Dim decNumber As Decimal = 12.987654
Dim strFormat As String = Format(decNumber, "#####.####")
MessageBox.Show(strFormat)

"Al Jones" wrote:
Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please tell
me what I'm not seeing!

Nov 21 '05 #2
Dim decNumber As Decimal = 12.987654
Dim strFormat As String = Format(decNumber, "#####.####")
MessageBox.Show(strFormat)

"Al Jones" wrote:
Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please tell
me what I'm not seeing!

Nov 21 '05 #3
Damn, I knew it was going to be something simple, but as many ways as I
looked up format (string format, numeric format, number format, etc) I
guess I didn't bother with just 'format'.

Thanks //al
On Wed, 26 Jan 2005 18:59:02 -0800, Crouchie1998
<Cr**********@discussions.microsoft.com> wrote:
Dim decNumber As Decimal = 12.987654
Dim strFormat As String = Format(decNumber, "#####.####")
MessageBox.Show(strFormat)

"Al Jones" wrote:
Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and
tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please
tell
me what I'm not seeing!


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Nov 21 '05 #4
Damn, I knew it was going to be something simple, but as many ways as I
looked up format (string format, numeric format, number format, etc) I
guess I didn't bother with just 'format'.

Thanks //al
On Wed, 26 Jan 2005 18:59:02 -0800, Crouchie1998
<Cr**********@discussions.microsoft.com> wrote:
Dim decNumber As Decimal = 12.987654
Dim strFormat As String = Format(decNumber, "#####.####")
MessageBox.Show(strFormat)

"Al Jones" wrote:
Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and
tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please
tell
me what I'm not seeing!


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Nov 21 '05 #5
Okay, now how do I get it to preserve leading spaces and while I'm begging
(I am begging, right?) how to force it to give me some 0's - not leading.
Okay, I've got the zero's (##0.0000) but this report wanders all over the
page ... help!
On Wed, 26 Jan 2005 18:59:02 -0800, Crouchie1998
<Cr**********@discussions.microsoft.com> wrote:
Dim decNumber As Decimal = 12.987654
Dim strFormat As String = Format(decNumber, "#####.####")
MessageBox.Show(strFormat)

"Al Jones" wrote:
Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and
tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please
tell
me what I'm not seeing!


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Nov 21 '05 #6
Okay, now how do I get it to preserve leading spaces and while I'm begging
(I am begging, right?) how to force it to give me some 0's - not leading.
Okay, I've got the zero's (##0.0000) but this report wanders all over the
page ... help!
On Wed, 26 Jan 2005 18:59:02 -0800, Crouchie1998
<Cr**********@discussions.microsoft.com> wrote:
Dim decNumber As Decimal = 12.987654
Dim strFormat As String = Format(decNumber, "#####.####")
MessageBox.Show(strFormat)

"Al Jones" wrote:
Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and
tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please
tell
me what I'm not seeing!


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Nov 21 '05 #7
Al,
The way I line things up is to define a method that prints to the left
of a given position by measuring the printed string and then offsetting the
print position by the approriate amount. I use Graphics.MeasureString using
one of the formats containing a StringFormat.GenericTypographic object.
This produces a report that is aligned correctly visually. If you were to
be really picky in alignment you might want to use MeasureCharacterRanges
instead. See numerous posts in microsoft.public.dotnet.framework.drawing
about MeasureString and accuracy.
Note that you can also allow for negative amounts shown in parenthesis
by offsetting the result of the x calculation back to the right by the width
of a closing parenthesis if this is relavent to your display needs.

psuedo code which may not be quite VB format
Sub PrintToTheLeftOf(String s, Single x, Single y, Font aFont, Brush aBrush,
Graphics aGraphics)
dim deltax as Single
deltax = aGraphics.MeasureString(s, aFont, new Point(x, y),
StringFormat.GenericTypographic).Width
aGraphics.DrawString(s, aFont, aBrush, x - deltax, y,
StringFormat.GenericTypographic)
End Sub

Ron Allen
"Al Jones" <al**********@shotmail.com> wrote in message
news:opsk8v1laaxhg4go@aljones...
Okay, now how do I get it to preserve leading spaces and while I'm begging
(I am begging, right?) how to force it to give me some 0's - not leading.
Okay, I've got the zero's (##0.0000) but this report wanders all over the
page ... help!
On Wed, 26 Jan 2005 18:59:02 -0800, Crouchie1998
<Cr**********@discussions.microsoft.com> wrote:
Dim decNumber As Decimal = 12.987654
Dim strFormat As String = Format(decNumber, "#####.####")
MessageBox.Show(strFormat)

"Al Jones" wrote:
Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and
tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please
tell
me what I'm not seeing!


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Nov 21 '05 #8
Al,
The way I line things up is to define a method that prints to the left
of a given position by measuring the printed string and then offsetting the
print position by the approriate amount. I use Graphics.MeasureString using
one of the formats containing a StringFormat.GenericTypographic object.
This produces a report that is aligned correctly visually. If you were to
be really picky in alignment you might want to use MeasureCharacterRanges
instead. See numerous posts in microsoft.public.dotnet.framework.drawing
about MeasureString and accuracy.
Note that you can also allow for negative amounts shown in parenthesis
by offsetting the result of the x calculation back to the right by the width
of a closing parenthesis if this is relavent to your display needs.

psuedo code which may not be quite VB format
Sub PrintToTheLeftOf(String s, Single x, Single y, Font aFont, Brush aBrush,
Graphics aGraphics)
dim deltax as Single
deltax = aGraphics.MeasureString(s, aFont, new Point(x, y),
StringFormat.GenericTypographic).Width
aGraphics.DrawString(s, aFont, aBrush, x - deltax, y,
StringFormat.GenericTypographic)
End Sub

Ron Allen
"Al Jones" <al**********@shotmail.com> wrote in message
news:opsk8v1laaxhg4go@aljones...
Okay, now how do I get it to preserve leading spaces and while I'm begging
(I am begging, right?) how to force it to give me some 0's - not leading.
Okay, I've got the zero's (##0.0000) but this report wanders all over the
page ... help!
On Wed, 26 Jan 2005 18:59:02 -0800, Crouchie1998
<Cr**********@discussions.microsoft.com> wrote:
Dim decNumber As Decimal = 12.987654
Dim strFormat As String = Format(decNumber, "#####.####")
MessageBox.Show(strFormat)

"Al Jones" wrote:
Okay, this is dumb....

In gwbasic I can print using "#####.####"; 12.987654 and that produces
,,,12.9876 (commas for spaces). I've looked at buildstring, and
tostring
but nothing I've seen gives me the ability to format with a non-currency
number position to the right of the decimal ... would someone please
tell
me what I'm not seeing!


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version:...
4
by: Julie Siebel | last post by:
Apologies...I'm sure this has been asked before, but I can't seem to come up with the correct Google search terms. While my problem is with stylesheets, the errors are being caused by my...
1
by: Michael Beck | last post by:
I need to select one of about 15 printers, which I have been able to do. Then I need to set that printer as the printer to use, run a Crystal Reports reports, and track if/when the printing job...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
2
by: Brad Pears | last post by:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
16
by: raylopez99 | last post by:
I am running out of printing paper trying to debug this...it has to be trivial, but I cannot figure it out--can you? Why am I not printing text, but just the initial string "howdy"? On the...
2
by: bob | last post by:
Hi, I have a page that has a collection of things which it passes to a second 'print' page using a session variable. The print page has buttons for moving though the collection and the user ...
3
by: =?Utf-8?B?QnJ5YW4=?= | last post by:
I have an application that hosts a web browser control. I would like to detect when ever the browser tries to print a page and rather than print the document, store the print job off in a database...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.