3 Replies - 2379 Views - Last Post: 13 March 2012 - 08:01 AM Rate Topic: -----

#1 michaelysnb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 17-December 11

Printing from a DataGrid

Posted 06 March 2012 - 07:49 AM

I have a DataGrid and I want to print the contents of it.
My Problem is i can't use datareport to print the contents of the datagrid because the number of fields is unknown.
Some fields are dynamically added.
Now, how should i print the contents? Is there a way in datareport? or others? or just print the whole form?
THANK YOU!!
Is This A Good Question/Topic? 0
  • +

Replies To: Printing from a DataGrid

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,781
  • Joined: 26-March 09

Re: Printing from a DataGrid

Posted 06 March 2012 - 08:24 AM

It's not something I've done myself, but if you run a google search on "dynamic datareport vb6" there are some examples on how to do it.
Was This Post Helpful? 0
  • +
  • -

#3 Toadill  Icon User is offline

  • D.I.C Regular

Reputation: 45
  • View blog
  • Posts: 411
  • Joined: 08-January 12

Re: Printing from a DataGrid

Posted 06 March 2012 - 08:44 AM

How about something like this

'Add a commonDialog control
private sub cmdPrint()
On Error GoTo errHandler_print
  With CommonDialog1
  .Copies = 1
  .Flags = &H0&  
  .ShowPrinter
  For i = 1 To CommonDialog1.Copies
      Printer.Print Form1.DataGrid1
      Printer.NewPage
  Next i
 Printer.EndDoc
 On Error GoTo 0
 Exit Sub

errHandler_print:

  On Error GoTo 0
  Exit Sub
  End With
end sub



Was This Post Helpful? 0
  • +
  • -

#4 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Printing from a DataGrid

Posted 13 March 2012 - 08:01 AM

I'd be interested to know if that works, if you can just do a print on a data grid and it will actually do it. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1