Solved print screen ..

Posted on 2006-11-22
Last Modified: 2008-02-01
Hi Folks,

I need some code that will allow me to print my program screen ( to be more precise.. print screen) to my network printer when i clicks a button on my win form.

Question by:niger007
  • 3
  • 2
LVL 16

Expert Comment

ID: 18000637
Hi niger007,

I'd recommend looking at these code samples:,7,10,1453


Author Comment

ID: 18000665
Kindly provide me some simple codes , will allow me print my win form when i clicks a button.
LVL 16

Expert Comment

ID: 18000765
No worries - but this is all straight from the source code that you can download from,7,10,1453

Note that to use it, you will have to incorporate the FormUtils and PrintImage classes from the source code (probably after converting them to VB - so it's not THAT easy :)

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' Instantiate our PrintDocument
        Dim pi As PrintImage = New PrintImage()
        ' Get a bitmap of the screen
        pi.Bitmap = FormUtils.FormToBitmap(Me)
        If PreviewPrintScreen = True Then
            ' preview the print
            Dim preview As PrintPreviewDialog = New PrintPreviewDialog()
            preview.Document = pi
            ' print to the printer
        End If
    End Sub

Author Comment

ID: 18001182

 FormUtils and PrintImage classes are in CS and i am very new to .NET programming so i wont be able to convert into Any other altrnatives.

Is there any alternative way for me to print my form data grid into my local printer. Do i still need to follow the tedious method which u mentioned above to accomplish this task.

LVL 16

Accepted Solution

Hillwaaa earned 250 total points
ID: 18001709
It depends - if you just want to print your data grid, then you could do the following:

Option 1 - use a custom DataGrid that has built in print functionality - you can download the source from:

Option 2 - print the contents of your existing DataGrid - download an example from:

The long and short of it is that printing from VB .NET is never (at least from what I've seen/done) just a case of click a button and out it comes.  You always have to do a bit of setup first :(


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question