?
Solved

C# Printing a DataGrid

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
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…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 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