VB.NET FORM VIEW print view

Hi..

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?
kavvisAsked:
Who is Participating?
 
gamarrojgqConnect With a Mentor Commented:
Hi,

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

http://msdn.microsoft.com/en-us/vbasic/bb735936.aspx

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
        PrintForm1.Print()

Hope it helps.
0
 
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 !!
0
 
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!!
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
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

        Printform1.Print()

    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!
0
 
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

        Printform1.Print()


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

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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.