Results 1 to 4 of 4

Thread: How to Show Print Dialog in PrintDocument?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    323

    How to Show Print Dialog in PrintDocument?

    Hi there,

    Please have a look on attached file, i am using PrintDocument using vb.net 2013, when i press print button it directly prints on printer, what i want is when user press print button it should show print dialog option so that user can change its printer.

    Please help me out how to resolve my issue.

    Thanks
    Ladak
    Attached Images Attached Images  

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

    Re: How to Show Print Dialog in PrintDocument?

    The dialogues related to printing are in the VS Toolbox. Add one to your form and then call its ShowDialog method.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2010
    Posts
    323

    Re: How to Show Print Dialog in PrintDocument?

    I already added PrintDialog1 but i don't know how to call it when user clicks on print button. there is no "Print button click" event in PrintDocument.

    Thanks
    Ladak

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: How to Show Print Dialog in PrintDocument?

    Quote Originally Posted by accmaster View Post
    I already added PrintDialog1 but i don't know how to call it when user clicks on print button. there is no "Print button click" event in PrintDocument.

    Thanks
    Ladak
    Of course there isn't. A PrintDocument doesn't have any buttons so why would it have a "Print button click" event? There's no "in" a PrintDocument. At the moment you have a PrintDocument and you call its Print method, probably in the Click event handler of a Button. As I said, add the appropriate print dialogue to your form and call its ShowDialog method to display it, probably in the Click event handler of a Button. You will assign your PrintDocument to the appropriate property of the dialogue and thus any changes the user makes in the dialogue are automatically pushed to the PrintDocument. When you then call Print, it will print based on those settings.

    You should already know that because you should have already read the MSDN documentation for the dialogue you want to display. That Help menu is there in VS for a reason. You should pretty much always use that first when you need help, then come here if you need more than it provides.

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