Click here to Skip to main content
Sign Up to vote bad
good
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
Edited 23-Jan-13 20:44pm
lukeer10.6K

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
Your Filters
Interested
Ignored
     
0 Christian Graus 577
1 Ron Beyer 341
2 Tadit Dash 243
3 samadhan_kshirsagar 229
4 OriginalGriff 201
0 Sergey Alexandrovich Kryukov 7,061
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,370
4 CPallini 3,034


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