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.
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.
5 posts Page 1 of 1
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Somepages
Dummy1912
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
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Somepages
Dummy1912
:teary;

nobody ?
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4390
Joined: Tue Aug 04, 2009 1:47 am

Re: Somepages
CodenStuff
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
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Somepages
Dummy1912
Hi,

Thanks for the tryout but didn't work :(
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
CodebrewVB
Just Registered
Just Registered
Posts: 2
Joined: Tue Jun 25, 2024 5:02 am

Re: Somepages
CodebrewVB
Hey!

Not sure if you noticed but you're missing a dot on the last line. Also, you need to set the PrinterSettings.PrintRange property before setting the FromPage and ToPage properties.

Give this a shot
Code: Select all
PrintDocument1.PrinterSettings.PrintRange = PrintRange.SomePages
PrintDocument1.PrinterSettings.FromPage = 2
PrintDocument1.PrinterSettings.ToPage = 2
5 posts Page 1 of 1
Return to “Coding Help & Support”