Click here to Skip to main content
12,455,701 members (79,902 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
I want to set page range while printing a document and for that code i am using is
if (txt_Browse.Text != "")
{
    streamToPrint = new StreamReader(txt_Browse.Text);
    if (range.Checked)
    {
        if (Startrange.Text != "" && Endrange.Text != "")
        {
            // PrintDialog PrintDialog1 = new PrintDialog();
            //PrintDialog1.user = true;
            printDocument.PrinterSettings.PrinterName = cmb_printername.Text;
 
            printDocument.PrinterSettings.FromPage = int.Parse(Startrange.Text);
            printDocument.PrinterSettings.ToPage = int.Parse(Endrange.Text);
            printDocument.DocumentName = txt_Browse.Text;
            printDocument.Print();
        }
But its not working.Need help.
Posted 23-Jan-13 20:01pm
Updated 23-Jan-13 20:44pm
lukeer16.6K
v3
Comments
Sanjeev Alamuri 24-Jan-13 2:10am
   
please be clear about ur question. whether it is Windows or Web. and paste some more code.
for windows, check here,
http://stackoverflow.com/questions/7461518/page-range-problem-at-printing-a-document
http://www.c-sharpcorner.com/uploadfile/mahesh/printdialog-in-C-Sharp/
lukeer 24-Jan-13 2:47am
   
In what method does you posted code belong?
To what object des it belong?

What's the exact error message you're getting?
What line of code does the error message point to?
Sergey Alexandrovich Kryukov 16-Apr-13 13:22pm
   
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership. And the fact you even self-accepted some formally is just outrageous, a sure way for a ban. I hope you won't do it after this warning.

Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160826.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100