Results 1 to 3 of 3

Thread: What is the best way create a report

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Location
    Oklahoma, USA
    Posts
    92

    What is the best way create a report

    Basically I need to give the user the option to print a hard copy of what's on a windows form. I designed a form below. Looking for the best way to get that done.

    Name:  Untitled.jpg
Views: 275
Size:  44.0 KB
    Name:  Shift_Log.jpg
Views: 318
Size:  43.8 KB
    Last edited by wjburke2; Jan 10th, 2020 at 02:34 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: What is the best way create a report

    Create a PrintDocument, call its Print method and handle its PrintPage event. That's how you do any printing in WinForms. In the event handler, you draw whatever you want printed using GDI+. There are plenty of examples around but I would suggest that you start by visiting the VB.NET CodeBank forum on this site and checking out the beginners' printing tutorial by Merrion.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: What is the best way create a report

    Note that you aren't going to want to do loads of printing during testing so you will likely also want to incorporate a PrintPreviewDialog, in the testing phase at least. You can associate it with your PrintDocument and then call its ShowDialog method and your printing code will be invoked but the drawing will be done on the dialogue rather than sent to the physical printer. You can then do an actual print run from the dialogue or cancel, so you won't be wasting loads of paper and ink/toner.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width