Hi.... can everyone help me pls in how to make program using visual basic that can Preview documents before printing.. 
Help me pls.. 
9 Years
Discussion Span
Last Post by babrad

i have a simple program that generates information using MS Access as database. my problem is how to get code in order to preview information from my db. I know how to retrieve from db but i don't know how to plot this into print preview or what components and what code should i do.


The best and most used way is to show your data on a datagrid and then print the grid Only. Attached is a sample that should work. Just change the MS Access database to your own, change the connection code etc. Hope this helps.


i do have a snapshot from other program that previews document for printing.. i'm so frustrated on how to do this thing.. help me pls... thanks to the attachment.. it helps a lot..

Attachments print_preview_sample.JPG 33.99 KB

The image looks like a crystal report generated preview. You can download crystal reports from http://reportviewer.biz/ or search for a test trial version.
Use the following link to get an idea as to what crystal reports are and how to set it up. http://www.codeguru.com/csharp/csharp/cs_graphics/chartsandgraphing/article.php/c10483

This is an add-on for vb6. I still think by using the attachment I've send you will help out easier without fuss.
You can also start experimenting with MS Data Report Designer, which is similar to crystal reports and forms part of your vb6 environment. Select 'Project' from your toolbar, select 'References' and scroll down to 'Microsoft Data Report Designer 6.0(your service pack level)'

Go to http://msdn.microsoft.com/en-us/library/aa733655(VS.60).aspx for all the help you need on the report designer.

Does this help?


yes,, it really helps a lot.. thanks... i'll work on this...
thank u so much AndreRet...


Only a pleasure buddy. Please mark as solved. Good luck in your coding. Let us know if we can help with anything else.

Hi.... can everyone help me pls in how to make program using visual basic that can Preview documents before printing.. 
Help me pls.. 

Using Visual Basic 4, 5 and 6
Use the PrintForm Method : ie as below its realy simple

sub command1_click
on error goto command1_error
form1.visible = true

end sub

you can lay out the document you wish to print on a form then using the printform methode print that form using the printform method. this will alow you to preview the doc before printing.

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)


i have this same matter on how to Preview form before printing it... there's anyone can help us..... I hope youcan help us....

This question has already been answered. 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.