Public Group

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

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

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 on other sites
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

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

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 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 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

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 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

1. 1
2. 2
3. 3
4. 4
Rutin
22
5. 5

• 13
• 19
• 14
• 9
• 9
• Forum Statistics

• Total Topics
632932
• Total Posts
3009296
• Who's Online (See full list)

There are no registered users currently online

×