Hi,
what is the vb.net version of Form.Print?
Cheers,
Printable View
Hi,
what is the vb.net version of Form.Print?
Cheers,
I have no idea. What did it do in VB6? :confused: (obviously i never used that feature)
Have you tried making a small sample VB6 app that uses it, and then converting that app into VB.NET?
If you are doing Web Programming - there is a Javascript function to print that will print the page.
Haven't come across anything in win forms in vb.net, - haven't really had the need - especially with the Crystal Reports integration.
A simple search for print form vb.net in the MSDN library gave me this:
http://msdn.microsoft.com/library/de...entcontrol.asp
Basically, I would use the info in that link to print the form. Get the graphics object of the form, then print that.
Form1.Print is used to display text on the formQuote:
Originally posted by MrGTI
I have no idea. What did it do in VB6? :confused: (obviously i never used that feature)
If you had:
Then the form would look like this:Code:Form1.Print "Text"
-----------Form-----------
Text
-----------Form-----------
Ohhh, if you are just printing text on the form, then you will need to use the forms graphics object and use the drawstring method.
So how would you Print text on the form using forms graphics object?
I will get an example, hold on.
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
e.Graphics.DrawString("This is my string", Font, New SolidBrush(SystemColors.WindowText), 50, 50)
End Sub
sorry every one. i got you on the wrong track.
I ment to say form.printform. This prints out the current form with all its contents.
I want to use this in stead of crystal reports. Crystal reports is giving me no joy at all.
any idea's
Cheers
I's sure you're talking about it ! This prints the whole form with all controls . anyways , it's no longer in .NET BUT there must be a way though . Let me check some resource out there . Hope I find an answer !
Now i know why i never used the .Print method. :)
The idea of .PrintForm seems interesting though,....
http://searchvb.techtarget.com/vsnet...293474,00.htmlQuote:
Originally posted by hellswraith
A simple search for print form vb.net in the MSDN library gave me this:
http://msdn.microsoft.com/library/de...entcontrol.asp
Basically, I would use the info in that link to print the form. Get the graphics object of the form, then print that.
http://www.dotnetnut.com/mb-detail.asp?Id=120
http://www.c-sharpcorner.com/Code/20...rmPrinting.asp
Do any of these links do anything for you? I did a simple search on google for "print form vb.net". There are more.
Funny thing is, I wonder if you can somehow make a copy of the graphics object of a form... and set the printer.graphics property to that.... unfortunately, its a read-only property....
However, it seems mostly possible.... since there is a component available on the web that prints VB.NET forms....
"How does PrintForm for .NET work? By hooking into the printing mechanism of the .NET runtime it is able to draw the controls on your Form straight to the PrintPreviewDialog or Printer. All you have to do is drop the PrintForm component onto a Windows Form and point it at the Container Control to print (Form, Panel, GroupBox etc), PrintForm takes care of the rest!
Want to see some examples of what it can do? View the PrintForm feature list, watch the product tour, or see some screenshots "
http://www.winformreports.co.uk/screenshots_pf.htm