Taha Khan
Taha Khan

Reputation: 43

How to print datagridview results?

How can I get a hardcopy print of the results shown in datagridview?

Upvotes: 0

Views: 2829

Answers (4)

Box
Box

Reputation: 11

You will have to use the DrawToBitmap function to save a snapshot of the DataGridView to a bitmap and then print that bitmap.

OR

You will have to write a function that ouputs the DataSource (DataTable, DataSet, etc..) to a text file or directly to a printer. Here are some examples:

Printing a DataTable to textbox/textfile in .NET

print gridviews, datagrids, or datatables

Upvotes: 1

Bill
Bill

Reputation: 4585

It's really easy to output as csv and then print it from Excel.

export Datagrid to excel asp

Upvotes: 0

Andrew Neely
Andrew Neely

Reputation: 908

Printing in Dot net can be either really easy by using the Crystal Report Document, or tedious through the print document. For a simple table, use Crystal. You can pass a data adapter directly to it.

Upvotes: 0

theUnrealGuy
theUnrealGuy

Reputation: 1

Since the DataGridVeiw is a reflection of a DataSet you can use DataSet.WriteXml(XmlFileName.xml) With this you can export the entire dataSet with all the tables in a XML File. YOu can then print this file !

Upvotes: 0

Related Questions