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
Solved

C# Printing many textboxes

Posted on 2004-03-21
4
284 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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