?
Solved

C# Printing many textboxes

Posted on 2004-03-21
4
Medium Priority
?
301 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Joeisanerd earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

765 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