+1 vote
28 views

I am new to C# and I am facing problem in printing a receipt when user clicks on a button or a on a specific event. I have try many methods but no one worked for me. Even I tried WebBroswer's method but it did not work for me.

sorry for my english!

by (1.4k points)   | 28 views

1 Answer

0 votes

Try this

PrintDialog printDialog = new PrintDialog();

            PrintDocument printDocument = new PrintDocument();

            printDialog.Document = printDocument; //add the document to the dialog box...        

            printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(CreateReceipt); //add an event handler that will do the printing

            //on a till you will not want to ask the user where to print but this is fine for the test envoironment.

            DialogResult result = printDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
            printDocument.Print();

            }
by (3.3k points)  

Related questions

+1 vote
1 answer
asked May 26, 2020 by toheed (1.4k points) | 20 views
+1 vote
1 answer
asked May 26, 2020 by toheed (1.4k points) | 66 views
0 votes
1 answer
+1 vote
1 answer
asked May 26, 2020 by toheed (1.4k points) | 24 views
+2 votes
1 answer
asked Jun 5, 2020 by toheed (1.4k points) | 33 views
+2 votes
2 answers
+1 vote
1 answer
+2 votes
1 answer
+2 votes
0 answers
asked Jun 12, 2020 by toheed (1.4k points) | 55 views




Welcome to Meansflow - Where Developers and Students Learn, Share, & Build Careers, where you can ask questions and receive answers from other members of the community.
131 questions
94 answers
44 comments
134 users