hi, can u help me, what can i do to print a form, example: in form1 there is a button that will print the form2 that has registration form.

it is possible or other ways? please help

4 Years
Discussion Span
Last Post by tmccmt

You can make use of the PrintForm class from the Power Packs.

For example:

Public Class Form2

    Public WriteOnly Property _PrintForm As Boolean
        Set(value As Boolean)
            If value = True Then
                Dim pf As New PrintForm
                    pf.Form = Me
                    pf.PrintAction = PrintToPrinter
            End If
        End Set
    End Property

End Class

Then to call it from form1:

Public Class Form1
    Private btnPrint_Click(ByVal sender As Object,ByVal e As EventArgs) Handles btnPrint.Click
        Form2._PrintForm = True
    End Sub
End Class

Or, you can manually print by using the PrintDocument event of a printing job.

This will require the use of the Graphics class.

Edited by Begginnerdev

Votes + Comments
PrintForm to the rescue :)

If you're printing a registration form, you probably don't want any of the extra stuff, like the control box or any buttons, to be printed. Something like this might work:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    'make any controls you don't want printed invisible
    Button3.Visible = False

    'print everything visible in the client area(no control box or form title)
    PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.CompatibleModeClientAreaOnly)

    'then make them visible again
    Button3.Visible = True
End Sub

Edited by tinstaafl


The resolution of printform is low and hoe to fix itl? that is make it high

Votes + Comments
1st post. Try next time to make it timely.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.