jvoros1
asked on
C# Printing a DataGrid
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
Janka
ASKER
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.
ASKER
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.GridColumnStyle s.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_Proje ctLogDrawi ngsInOut"] .Columns[" UserID"].D efaultValu e = 0;
tableStyle.GridColumnStyle s.Add(cs);
dataGrid1.TableStyles.Add( tableStyle );
dataGrid1.DataSource = aDataTable;
cs = new DataGridTextBoxColumn();
cs.MappingName = "PermitApprov";
cs.HeaderText = " Permit / Approve. Etc ";
cs.Width = 200;
cs.Alignment = HorizontalAlignment.Center
tableStyle.GridColumnStyle
dataGrid1.TableStyles.Add(
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_Proje
tableStyle.GridColumnStyle
dataGrid1.TableStyles.Add(
dataGrid1.DataSource = aDataTable;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could also use Crystal Reports to make the data layout look better for printing.