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

Started by
4 comments, last by SuperDre 19 years, 4 months ago
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.
Advertisement
not quite sure but I think this would be what you are looking for

Dim strHeader As StringstrHeader = "Person's Name Here, " _          + "Auditor for " _          + auditCompany.Text _          + "                           " _          + todaysDate.TextPrinter.Print strHeaderstrHeader = "" '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
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
OK this is wierd, I don't understand why but it fixes the problem

Printer.Print "Person's Name Here, ";  ' Concatenates This linePrinter.FontBold = FalsePrinter.FontItalic = TruePrinter.Print "Auditor for "; ' Concatenates This line on same linePrinter.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
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.
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

This topic is closed to new replies.

Advertisement