VB.NET FORM VIEW print view


I have a form with some textboxes with some values in it...

I would like to do this..
"Screen shoot"  move into some print previe tool and hava a choice to ex. save as a pdf file... or send with email...  is it the reporting tool I have to use?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


If your form is in VB.net, for a simple report with the "Screen Shoot" of your form, you can download the Visual Basic Power Packs


And use the PrintForm Control, that allow you print or preview you form, just add a button and in the Click event add this code:

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

Hope it helps.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kavvisAuthor Commented:
thank you very mutch.. now I´m very close to the solution...

byt can I somehow set it to take a print screen on the acueally form?  now it takes a big picture so I only se a small pice of my form..

I would like to have it in landskape to I think.. thank you !!
kavvisAuthor Commented:
thank you I alomst get the landscape funtkion to work.. Yes I got the landscpae function but I can´t the the whole form to fit.. Can I somehow autosize it to fit to a A4 and landscape..

And the second qusetion I have search but can´t find it.. can I have the save as PDF function on this  Print Control?     In my best word I would like to have send to email button to!!
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

kavvisAuthor Commented:
thank you..
this code works ok.. not exacly as I wanted but almost if someone has any tips to get my real function please ad som comment!

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim Printform1 As New Microsoft.VisualBasic.PowerPacks.Printing.PrintForm(Me)

        Printform1.PrinterSettings.PrinterName = "Adobe PDF"
        Printform1.PrinterSettings.DefaultPageSettings.Landscape = True


    End Sub

Function right now...
1.When I hit the button I take a printscreen
2. choose save location for the pdf file
3. then ADobe reader opens up an shows the pdf file..
4. I can send it with email trou adobe..

My function I wanted is like this.

1. Button hit take screenshoot
2. show some printview with send function on the meny  and save function on the meny..  
3. done..

I know I can ad
 PrintForm1.PrintAction = Drawing.Printing.PrintAction.PrintToPreview

that line but then it´s open with the fromprint control an that has only print out function I want email function direcly...

Thank you!
kavvisAuthor Commented:
I have a nother problem..

I can´t get the Printscreen to fit on a A4 Papper..

I have tested this code..

        Dim myForm As frmH20Statistic
        myForm = frmH20Statistic.Instance

        Dim Printform1 As New Microsoft.VisualBasic.PowerPacks.Printing.PrintForm(myForm)

        Printform1.PrinterSettings.PrinterName = "Adobe PDF"
        Printform1.PrinterSettings.DefaultPageSettings.Landscape = True
        Printform1.PrinterSettings.DefaultPageSettings.Margins = New System.Drawing.Printing.Margins(10, 10, 10, 10)
        ' PrintForm1.PrintAction = Drawing.Printing.PrintAction.PrintToPreview


but i can´t get the whole from on a papper.. want to auto szrink it.. som howe..

With this printform control I don't thik you can do that, for that functionality, you need to use Crystal Reports instead (or any other third-party addon), but you will have to draw the hole form inside a new Crystal RPT.

Crystal will allow you to Export to PDF, Excel and other formats directly from the preview window and depending on the Crystal version also will let you send by email.

Another way is to take a snapshot of your screen and use de print controls of visual studio to handling the preview, with this you will be able to resize the imagen to A4 page size but you won't have Export or Send By Email functionality, those you will have to code it
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.