+1 vote
12 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.3k points)   | 12 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.2k points)  

Related questions

+1 vote
1 answer
asked May 27 by toheed (1.3k points) | 12 views
+1 vote
1 answer
asked May 27 by toheed (1.3k points) | 16 views
0 votes
1 answer
+1 vote
1 answer
+2 votes
1 answer
asked Jun 5 by toheed (1.3k points) | 16 views
+1 vote
2 answers
+2 votes
1 answer
+2 votes
0 answers
asked Jun 12 by toheed (1.3k points) | 14 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.
117 questions
87 answers
40 comments
105 users