Solved

C# Printing a DataGrid

Posted on 2004-03-21
4
521 Views
Last Modified: 2012-05-04
Hello Expert is there an easy way to print the dataGrid when the user hits print on a Windows From  and only the columns that are visible not all the ones that are hidden?

Janka
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
4 Comments
 
LVL 9

Expert Comment

by:Joeisanerd
ID: 10645917
did you still want to print all of the rows? When you use a dataGrid and limit the number of columns to display it creates a dataview. You would then use that dataview to print only the data that is shown.

You could also use Crystal Reports to make the data layout look better for printing.
0
 

Author Comment

by:jvoros1
ID: 10645970
Do you have anywhere a sample of code to show me by any chance I am pretty new to C# and I never printed before.
0
 

Author Comment

by:jvoros1
ID: 10645976
this Is an example of my dataGrid binding
                  cs = new DataGridTextBoxColumn();
                  cs.MappingName = "PermitApprov";
                  cs.HeaderText = " Permit / Approve. Etc ";
                  cs.Width = 200;
                  cs.Alignment = HorizontalAlignment.Center;
                  tableStyle.GridColumnStyles.Add(cs);
                  dataGrid1.TableStyles.Add(tableStyle);

                  cs = new DataGridTextBoxColumn();
                  cs.MappingName = "UserID";
                  cs.HeaderText = " User ID";
                  cs.Width = 0;
                  cs.Alignment = HorizontalAlignment.Center;
                  //Sets the Default Value of userID
                  aDataSet.Tables["tbl_ProjectLogDrawingsInOut"].Columns["UserID"].DefaultValue = 0;
                  tableStyle.GridColumnStyles.Add(cs);
                  dataGrid1.TableStyles.Add(tableStyle);

                  dataGrid1.DataSource = aDataTable;
0
 
LVL 9

Accepted Solution

by:
glsac earned 500 total points
ID: 10646274
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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
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
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

688 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