Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the WinForms/Console Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2009, 04:02 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default Printing DataGridView in VB 2008

Hi

I am going round and round the DataGridView trying to print the Datat it contains.

I maneged to print the row Numbers, the string name, tru values , false values... but not what i need.
Code:
PrivateSub PrintDocument1_PrintPage(ByVal sender AsObject, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage ' create a new font to print with...Dim fnt AsNew Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Point)' print the text from the text box...e.Graphics.DrawString(DataGridViewSearch.Rows.Coun t, fnt, Brushes.Black, 0, 0)' end printing by indicating there are no more pages...e.HasMorePages = FalseEndSub
as you can see here DataGridViewSearch.Rows.Count is printing the number of rows,

Is there another property that prints the data...

Or Can i disply the same data in RichTextBox,?
__________________
bx
 
Old June 30th, 2009, 09:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Well.. I my mind doesn't trick me, rows is a collection that you can iterate and get the value of every column inside it...
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old July 1st, 2009, 03:35 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

I Found this and it works

http://social.msdn.microsoft.com/for...-ef09fb357aee/
__________________
bx
 
Old February 8th, 2012, 07:29 AM
Registered User
 
Join Date: Feb 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Printing a datagridview in visul basic 2008 and 2010

HI,

I have tried the recommended code and it does most of what it calims to do. I have one problem. I cannot get it to print the "InhertitedStyle" for the text or formatting. A typical example is for the header text whic is as follows:

Code:
 e.Graphics.DrawString(oColumn.HeaderText, oColumn.InheritedStyle.Font, New SolidBrush(oColumn.InheritedStyle.ForeColor), New RectangleF(oColumnLefts(i), nTop, oColumnWidths(i), nHeight), oStringFormat)
What am I doing wrong?


Mike
 
Old February 10th, 2012, 03:52 PM
Registered User
 
Join Date: Feb 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Printing DataGrid in Vb.Net

visit
http://testspot.net/guest/search.asp...grid+in+Vb.net
 
Old February 10th, 2012, 05:32 PM
Registered User
 
Join Date: Feb 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Printing DataGridview in 2008

Thanks for the reply but that just takes a bit map of the datagridview complete with scroll bars. I need to print the datagridview row by row.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing DataGridView in VB 2008 bex ASP.NET 3.5 Basics 1 June 30th, 2009 02:57 PM
VB.NET 2003 Appendix B convert to VB 2008 Express Edition brucechess BOOK: Beginning VB.NET Databases 10 February 5th, 2009 12:52 PM
Printing from VB 2008 BroadwayLion Visual Basic 2008 Essentials 1 September 27th, 2008 12:02 PM
why buy vs-2008 instead of vb-2008 jerryham VB.NET 7 September 2nd, 2008 02:39 PM
How do I write this vb 6 code to work in vb 2008? sanderson Visual Basic 2008 Essentials 3 June 10th, 2008 01:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.