 |
hutton Level: Protégé
 Registered: 05-08-2005 Posts: 6
|
How to do "Print Using" in VB6?
This has got to be ridiculously simple, but bear with me.
I want to print 3 real numbers, with different numbers of decimal points. I cannot find an example of the Format$() cmd with more than one variable.
Format$(a,b,c,"#.00 #.000 #.0000")
doesn't work.
Thanks
Jim
|
|
05-08-2005 at 09:54 PM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: How to do "Print Using" in VB6?
have you tried
Format$(a,"#.00")
Format$(b,"#.000")
Format$(c,"#.0000")
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
08-08-2005 at 12:03 AM |
|
|
hutton Level: Protégé
 Registered: 05-08-2005 Posts: 6
|
Re: How to do "Print Using" in VB6?
Thanks, Goran, for the reply.
But I was looking for a Format$ statement with more than one variable.
Something like
Format$(a, b, c, "#.000") if you want 3 decimals for all three.
If they are different numbers of decimal places, than I expect it to be slightly more complicated, but still one format$ cmd.
thanks again.
Jim
|
|
08-08-2005 at 01:38 AM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: How to do "Print Using" in VB6?
AS far as I am aware, it is not possible to achieve what you want with format function, or any other.
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
09-08-2005 at 08:14 PM |
|
|
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1616
|
Re: How to do "Print Using" in VB6?
You could create you're own routine to do it... if you really want to (or just have multiple varialbes to format a lot):
Private Sub FormatVariables(ByVal theFormat As String, ParamArray Variables() As Variant)
Dim i As Integer
For i = LBound(Variables()) To UBound(Variables())
' This will change the original values
Variables(i) = Format(Variables(i), theFormat)
Next
End Sub
Private Sub Form_Load()
Dim a, b, c, d, e, f, g As Single
Dim i As Integer
a = Rnd
b = Rnd
c = Rnd
d = Rnd
e = Rnd
f = Rnd
g = Rnd
Debug.Print a
Debug.Print b
Debug.Print c
Debug.Print d
Debug.Print e
Debug.Print f
Debug.Print g
FormatVariables "#.00", a, b, c, d, e, f, g
Debug.Print a
Debug.Print b
Debug.Print c
Debug.Print d
Debug.Print e
Debug.Print f
Debug.Print g
End Sub
|
____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)
|
|
09-08-2005 at 08:46 PM |
|
|
|
|
 |
 |