Solved

C# Printing many textboxes

Posted on 2004-03-21
4
259 Views
Last Modified: 2010-04-15
Hello Expert I was wondering if you could show me how i can format the information I have to a certain layout I want it to print to the printer this is what i want it too look like

Company Number: 979734    Company Name: Willson   Year:2004
ContactName: Mike Smith

this is what my code looks like

printDialog1.Document = ThePrintDocument;
string strText = "Company Number: " + this.lblProjectNo.Text
       + "Company Name" + this.txtProjectName.Text
      + " Year " + this.txtYear.Text
      + " ContactName " + this.cmbName.Text;

But this does prints all in one line and I don't want it too can you help please.
0
Comment
Question by:jvoros1
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Joeisanerd earned 500 total points
ID: 10645760
Try chaning it to the following


this is what my code looks like

printDialog1.Document = ThePrintDocument;
string strText = "Company Number: " + this.lblProjectNo.Text
      + "Company Name" + this.txtProjectName.Text
     + " Year " + this.txtYear.Text
     + "\r\nContactName " + this.cmbName.Text;

what I added was the \r\n which is the return character and the newline. I put both there because one or the other should do the trick so you can try it with \r and if that doesn't work try \n.
0
 

Author Comment

by:jvoros1
ID: 10645778
Thanks so much it worked :)
0
 

Author Comment

by:jvoros1
ID: 10645880
just one thing for allignment is there such thing as \t for like tab?
0
 
LVL 9

Expert Comment

by:Joeisanerd
ID: 10646035
yes that is right.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now