Controlling the length of a number

alktrigger

Aimless Extraordinaire
Local time
Today, 16:20
Joined
Jun 9, 2009
Messages
124
I am creating a percent line in my code in an effort to summarize data in a report. I'm quite rusty on my VB, and I just can't remember how to limit the length of numbers

my code is as follows:

Code:
lblPerct.Caption = Str((lblSending.Caption / lblTotal.Caption) * 100) & "%"

the code works flawlessly minus the fact that it outputs to 13 decimal places. What is the command to limit length to one decimal?
 
The Round() function would be one way.
 
solved it via Format() command. Thanks for the suggestion.

Here is my final code. Using the "%" sign eliminated the need for the " * 100" portion of my original code.

Code:
lblPerct.Caption = Format(Str((lblSending.Caption / lblTotal.Caption)), "#00%")
 

Users who are viewing this thread

Back
Top Bottom