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

Comment Utility
Hi niger007,

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


Author Comment

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

Expert Comment

Comment Utility
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

Comment Utility

 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now