Results 1 to 14 of 14

Thread: Form.Print is no more

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Location
    Australia
    Posts
    73

    Form.Print is no more

    Hi,

    what is the vb.net version of Form.Print?

    Cheers,
    Hugh Rees
    SERTEV Technologies
    (07) 3375 9806
    0410 585 754
    WWW.SERTEV.COM

  2. #2
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277
    I have no idea. What did it do in VB6? (obviously i never used that feature)

    Have you tried making a small sample VB6 app that uses it, and then converting that app into VB.NET?
    ~Peter


  3. #3
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    If you are doing Web Programming - there is a Javascript function to print that will print the page.

    Haven't come across anything in win forms in vb.net, - haven't really had the need - especially with the Crystal Reports integration.

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    A simple search for print form vb.net in the MSDN library gave me this:
    http://msdn.microsoft.com/library/de...entcontrol.asp

    Basically, I would use the info in that link to print the form. Get the graphics object of the form, then print that.

  5. #5
    Addicted Member ProgrammerJon's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    203
    Originally posted by MrGTI
    I have no idea. What did it do in VB6? (obviously i never used that feature)
    Form1.Print is used to display text on the form
    If you had:
    Code:
    Form1.Print "Text"
    Then the form would look like this:

    -----------Form-----------
    Text


    -----------Form-----------

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Ohhh, if you are just printing text on the form, then you will need to use the forms graphics object and use the drawstring method.

  7. #7
    Addicted Member ProgrammerJon's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    203
    So how would you Print text on the form using forms graphics object?

  8. #8
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I will get an example, hold on.

  9. #9
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
    e.Graphics.DrawString("This is my string", Font, New SolidBrush(SystemColors.WindowText), 50, 50)
    End Sub

  10. #10

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Location
    Australia
    Posts
    73

    wrong track

    sorry every one. i got you on the wrong track.

    I ment to say form.printform. This prints out the current form with all its contents.

    I want to use this in stead of crystal reports. Crystal reports is giving me no joy at all.

    any idea's

    Cheers
    Hugh Rees
    SERTEV Technologies
    (07) 3375 9806
    0410 585 754
    WWW.SERTEV.COM

  11. #11
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I's sure you're talking about it ! This prints the whole form with all controls . anyways , it's no longer in .NET BUT there must be a way though . Let me check some resource out there . Hope I find an answer !

  12. #12
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277
    Now i know why i never used the .Print method.

    The idea of .PrintForm seems interesting though,....
    ~Peter


  13. #13
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Originally posted by hellswraith
    A simple search for print form vb.net in the MSDN library gave me this:
    http://msdn.microsoft.com/library/de...entcontrol.asp

    Basically, I would use the info in that link to print the form. Get the graphics object of the form, then print that.
    http://searchvb.techtarget.com/vsnet...293474,00.html

    http://www.dotnetnut.com/mb-detail.asp?Id=120

    http://www.c-sharpcorner.com/Code/20...rmPrinting.asp

    Do any of these links do anything for you? I did a simple search on google for "print form vb.net". There are more.

  14. #14
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Funny thing is, I wonder if you can somehow make a copy of the graphics object of a form... and set the printer.graphics property to that.... unfortunately, its a read-only property....

    However, it seems mostly possible.... since there is a component available on the web that prints VB.NET forms....

    "How does PrintForm for .NET work? By hooking into the printing mechanism of the .NET runtime it is able to draw the controls on your Form straight to the PrintPreviewDialog or Printer. All you have to do is drop the PrintForm component onto a Windows Form and point it at the Container Control to print (Form, Panel, GroupBox etc), PrintForm takes care of the rest!
    Want to see some examples of what it can do? View the PrintForm feature list, watch the product tour, or see some screenshots "

    http://www.winformreports.co.uk/screenshots_pf.htm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width