Need help in printing a dynamic form


Active member
Dec 4, 2004
Programming Experience

i have a form on which different things (labels, graph, etc) are drawn on runtime based on the values in the database. Now the problem is i want to get the print preview and then print this form but i dont know how. I read somewhere that whe have to draw everything in Form_PrintPage(......) method to do this.
isnt there any easier way cause ill have to run every query again to do this :(
can i create an image of this form and later print n print preview that image

plz help me.
Last edited:
i am using printDocument but it simply shows me an empty page in printpreview.

im attachin a file plz check it


  • report.txt
    58.5 KB · Views: 212
To print the entire form as is simply add the provied module to the project, then in the form you want printed simply use:
Call PrintForm(Me)

basically it'll take a screenshot of the form and print it like a bitmap
Last edited:
That was some code :) . WEll it works but prints only the part of form which is visible on the screen but the rest of the form which is below or above is just ignored.
hi does that provided module need any references or import statements?
because when i added it, i got 12 build errors, with things like 'picturebox not declared' and 'theform not declared' and 'messagebox not declared'.
it does, but the references are already imported by default in the IDE, unless of course someone's removed them in which case you can add them back or put in these lines:
Imports System
Imports System.Windows.Forms

also when i get the chance i'm going to fix up that module and try to solve some of the problems it has as well

I use your FormUntilities.vb and call print the form by including this line of code 'Call PrintForm(Me)' in my aspx form, but it gives me this error: c:\inetpub\wwwroot\Proj1\Form1.aspx.vb(601): Value of type 'Proj.dispForm' cannot be converted to 'System.Windows.Forms.Form'.

Please advise what I should do to solve this problem.