{ Learn Code. Share Code. Teach Code. Love Code. }

  • Somepages

  • If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules: Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
 #84411  by Dummy1912
 Sun Jul 29, 2018 8:46 am
Hello,

can someone help me
with our print range?

it seems we can't use the frompage and topage
to print the pages we want

search on the net for hours found some examples
but its not working....

anyone?
Code: Select all

        PrintDocument1.PrinterSettings.FromPage = 2
        PrintDocument1.PrinterSettings.ToPage = 2
        PrintDocument1PrinterSettings.PrintRange = PrintRange.SomePages

even we added on the beginprint
Code: Select all
If (CType((sender), System.Drawing.Printing.PrintDocument)).PrinterSettings.FromPage = 0 AndAlso (CType((sender), System.Drawing.Printing.PrintDocument)).PrinterSettings.ToPage = 0 Then
            PrintDocument1.PrinterSettings.FromPage = Integer.Parse(pageNum)
            PrintDocument1.PrinterSettings.ToPage = Integer.Parse(totalPages)
            PrintDocument1.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.SomePages
        End If
please...

Thank you
 #84414  by CodenStuff
 Sat Aug 11, 2018 5:39 pm
Sorry Dummy1912 I don't have much experience using printer controls, never had the need for them myself lol

Try adding this to your code before or after you set topage/frompage
Code: Select all
PrintDocument1.AllowSomePages = True
OR
Code: Select all
PrintDocument1.AllowSelection = True