Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

C# Printing many textboxes

Posted on 2004-03-21
4
Medium Priority
?
310 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

636 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