CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Location
    Malaysia
    Posts
    56

    Print dialog box

    Hi all,
    I am using VB 5 and I am calling the print dialog box in my program. I would like to set the print range in this dialog box but am not sure how. Any suggestions???

    Thanks



  2. #2
    Join Date
    Dec 1999
    Location
    Malaysia
    Posts
    56

    Re: Print dialog box

    Dear all,

    Found out the solution. =)
    Anyway, just want to share this with you all.
    In order to set the page range, do this before calling the "ShowPrinter" method.


    commondialog1.Flags = 2 'The print dialog's Page range is now set
    commondialog1.FromPage = 'whatever number you like
    commondialog1.ToPage = 'whatever number you like
    commondialog1.Max = 'the same number you chose for the "ToPage" property. THIS is VERY IMPORTANT!
    commondialog1.ShowPrinter



    The "max" property of the dialog must be set in order to tell the system that you have a maximum amount of pages to print. Otherwise, you will get a runtime error of "28665:PrintDlg failed during initialization"
    This would set the Page range for the Print dialog... hope that this helps.

    Aahh... coding relief!!

    ____________________________________
    The VB Bugs in my Life...

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

Featured