Printing form in vb.net (Urgent)

Hema Rawat

Member
Joined
Dec 12, 2005
Messages
24
Location
India
Programming Experience
1-3
I have to create a Entry Ticket & then Print it
Now How to Print the VB.net forms with all controls on it
1 Logo (PictureBox)
2. Labels of Name & Address Etc
3. Barcode is also on my entry ticket form

Except the Print Button on it.


Waiting for all early replies


Thanks in advance for this esteemed help

Hema Chaudhry
 
Look into Reports

Sounds more like you are trying to generate a report. You need to create a report, pass it the information on the form and print the report. You could display the report in a crystal report viewer which has the print functions incorporated, or you could print the crystal report directly with a print dialog box on your form..

Here is some code for printing a Purchase Order:

VB.NET:
            Dim PO As New rptPurchaseOrder1
            PrintDialog1.Document = New System.Drawing.Printing.PrintDocument
            If PrintDialog1.ShowDialog() = DialogResult.OK Then
                PO.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName
                PO.PrintToPrinter(PrintDialog1.PrinterSettings.Copies, True, 1, 99)
            End If

Hope that helps,
 
Hi

I am not sure it will work,But some how it gives the idea on Pring Form.
Plz try by replacing the document selection with Current active form.

Print using print dialog
1)Add a print dialog and document.
2)Dim a global pagesettings
3)set the printDocument's default pagesettings to your dimmed pagesettings
4)Use this to start the printing:

Code:
printDialog.document=printDocument
if printdialog.showdialog=dialogresult.ok then
printdocument.print
end if
5)Handle the printDocument.print event. Use the e.graphices to draw your images, text etc. Use e.hasmorepages at the end to finist printing or to loop through the print event again.
 
Back
Top