Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Formatting a number
Message
From
11/03/1998 20:33:40
 
 
To
11/03/1998 16:29:24
General information
Forum:
Visual Basic
Category:
VBScript
Miscellaneous
Thread ID:
00084017
Message ID:
00084059
Views:
15
Hi Michel,

First, let me remind you, in case you forgot, that strings are aligned left and numbers are aligned right. I still think that's a International standard but if anybody could clarify this for us, it would be nice....

Second, text controls have an alignment property; left, center, right, whether on forms or reports.

Third, if you still ignore those 2 first point then I give you the codes below.

Try this...

'on click of a command button, call the function AddSpaceToAlignLeft with a _ string parameter.

Private Sub Command1_Click()
Me!Text1.Text = AddSpaceToAlignLeft(Me!Text1.Text)
End Sub


Public Function AddSpaceToAlignLeft(ByVal StrReceiveValue As String) As String
Dim IntLenght, IntSpaceToAdd As Integer

'Determine the total lenght of the string received
IntLenght = Len(StrReceiveValue)
'Calculate the total space needed. 11 because 8 + "." + 2
IntSpaceToAdd = 11 - IntLenght
'Return the added space and the original string value
AddSpaceToAlignLeft = Space(IntSpaceToAdd) & StrReceiveValue

End Function

Good luck
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform