Jump to content
  • Advertisement
Sign in to follow this  
phil05

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

This topic is 4962 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!