borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Printing in Draft Mode on a Dot Matrix Printer)Next Topic (Custom Paper Size with Printer Object) New Topic New Poll Post Reply
AndreaVB Forum : Printing : How to do "Print Using" in VB6?
Poster Message
hutton
Level: Protégé

Registered: 05-08-2005
Posts: 6

icon 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
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
hutton
Level: Protégé

Registered: 05-08-2005
Posts: 6
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1616
icon 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
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
hutton
Level: Protégé

Registered: 05-08-2005
Posts: 6
icon Re: How to do "Print Using" in VB6?

THanks for the great solution.
otoh, it amazes me that "print using" is no longer an option.
I suddenly feel even older.....
Jim

16-08-2005 at 04:38 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : How to do "Print Using" in VB6?
Previous Topic (Printing in Draft Mode on a Dot Matrix Printer)Next Topic (Custom Paper Size with Printer Object) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder