Sign in to follow this  

VB 6.0 - Contatinating three strings in one line while printing to paper?

This topic is 4749 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need this whole code to print on one line. However, it's currently printing each string in seperate lines. How can I get it to print in one line as I set new properties with it?
Printer.Print "Person's Name Here, "  ' Concatenates This line
        .FontBold = False
        .FontItalic = True
        Printer.Print "Auditor for " ' Concatenates This line on same line
        Printer.Print auditCompany.Text + "                           ";
        Printer.Print todaysDate.Text ' Prints TODAY'S DATE on top-right corner. Same line.

Share this post


Link to post
Share on other sites
not quite sure but I think this would be what you are looking for


Dim strHeader As String

strHeader = "Person's Name Here, " _
+ "Auditor for " _
+ auditCompany.Text _
+ " " _
+ todaysDate.Text

Printer.Print strHeader

strHeader = "" 'Assuming you are done with strHeader at this point'







Although I myself am a beginner as well, just trying to help with ideas ;)

edit: Never mind, not sure how to work the font property changes into it sorry

Share this post


Link to post
Share on other sites
This code might not work (I don't have VB6 installed and it has been a while..)

Add a rich text box
rtb = name of rich text box

rtb.selbold = true
rtb.seltext = "Person's Name Here, " + "Auditor for " + auditCompany.Text + todaysDate.Text
rtb.selstart = len(rtb.text) - len("Person's Name Here, " + "Auditor for " + auditCompany.Text + todaysDate.Text)
rtb.sellength = 9999
rtb.SelItalic = true
rtb.selbold = false

Share this post


Link to post
Share on other sites
OK this is wierd, I don't understand why but it fixes the problem


Printer.Print "Person's Name Here, "; ' Concatenates This line
Printer.FontBold = False
Printer.FontItalic = True
Printer.Print "Auditor for "; ' Concatenates This line on same line
Printer.Print auditCompany.Text + " ";
Printer.Print todaysDate.Text ' Prints TODAY'S DATE on top-right corner. Same line.




just add semicolon's after each line that has a print method call

Share this post


Link to post
Share on other sites
hehe cool. Thanks for the help everyone. Even though it's too late for answers, I solved it some other way, but reading this helped my knowledge for next time. Thanks again.

Share this post


Link to post
Share on other sites
or even a much simpeler solution, it's about the same as 0111_of_1001 only with even a little bit less code:

Printer.Print "Person's Name Here, "; ' Concatenates This line
Printer.FontBold = False
Printer.FontItalic = True
Printer.Print "Auditor for " & auditCompany.Text & space(27) & todaysDate.Text

Share this post


Link to post
Share on other sites

This topic is 4749 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this