thanks for the reply teejayem...the link to MSDN print document class was good but in the coding we have to give the path of the file to be printed ....
streamToPrint = new StreamReader
("C:\\Documents and Settings\\Administrator\\My Documents\\doc1.txt");.....
but what i wanted was that the text entered by the user in the text box etc. of the running form should be printed...how can i do that?
The example just shows the use of a StreamReader; However, it can be what ever type you want it to be (as long as you can get it as a string come time to print). You need a member variable for your data and in the "private void pd_PrintPage(object sender, PrintPageEventArgs ev)" (in the example) you loop through your data and print it accordingly.
Here is a quick example of what you want to do (i think). Here[^] is the image of the form. Here[^] is the image of the output. Below is the code. Please let me know if this is what you need. NOTE: there still needs more work done in the print event handler (like counting the lines for page breaks).
thanks a lot teejayem ...your code works like a charm ...only one correction...
PrintDocument printDocument1 = new PrintDocument();
had to be declared....thanks a lot...u saved my day(infact u saved me many hours of searching on google)
My Boss give me a project and say read it Compleatly in this Project there is Class Called CaspolSecurityPolicyCreator.cs i serach it on net but did not Found any help can any body tell me why we use it. The Project is Of add-on on Outlook
Although I've been programming for years but I need somebody to explicitly assure me that I am correct as I am developing a critical piece of software. The problem is that when you need a very basic rule you cannot find it on search engines
when I define a variable of bool like this:
is it automatically initialized to false?
what about int? is it automatically initialized to zero?
And ever has it been that love knows not its own depth until the hour of separation