Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > WinForms/Console Application Design
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 30th, 2009, 05:02 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
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
  #2 (permalink)  
Old June 30th, 2009, 10:55 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,190
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.
================================================== =========
  #3 (permalink)  
Old July 1st, 2009, 04:35 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Location: london, , United Kingdom.
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
  #4 (permalink)  
Old February 8th, 2012, 07:29 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Location: Surrey, UK
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
  #5 (permalink)  
Old February 10th, 2012, 03:52 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
  #6 (permalink)  
Old February 10th, 2012, 05:32 PM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Location: Surrey, UK
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.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing DataGridView in VB 2008 bex ASP.NET 3.5 Basics 1 June 30th, 2009 03: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 01:02 PM
why buy vs-2008 instead of vb-2008 jerryham VB.NET 7 September 2nd, 2008 03:39 PM
How do I write this vb 6 code to work in vb 2008? sanderson Visual Basic 2008 Essentials 3 June 10th, 2008 02:46 PM



All times are GMT -4. The time now is 11:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.