Results 1 to 4 of 4

Thread: [RESOLVED] Printing to a Form

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,462

    Resolved [RESOLVED] Printing to a Form

    Took me ages to figure out why it didn't seem to work

    Eventually found you need Form1.Print "hi", not Me.Print, or With Me etc.
    Nor did it seems to work in Form Load.

    Anyway, bigger problem.. any other window that's moved over the Form wipes out the printing.
    Is there a solution for that ? Thanks...

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Printing to a Form

    Actually Just Print will work fine so long as the code is in the target form.
    You need to specify the form name is the code if outside the form.


    Try this
    Code:
    Private Sub Form_Load()
    Me.AutoRedraw = True
    Print "Hello World I'm Loading"
    End Sub
    Auto redraw keeps the text from disappearing

  3. #3
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Printing to a Form

    Quote Originally Posted by AlexanderBB View Post
    Eventually found you need Form1.Print "hi", not Me.Print, or With Me etc.
    Nor did it seems to work in Form Load.
    It works for me, but Print doesn't listed in intellisense, try this
    vb Code:
    1. Private Sub Command1_Click()
    2.     Form1.Print "Form1"
    3.     Me.Print "Me"
    4.     Print "Hi" ' no need for Me
    5. End Sub

    Anyway, bigger problem.. any other window that's moved over the Form wipes out the printing.
    Set the form's property AutoRedraw to True

    Edit
    Sorry, i didn't see DataMiser's answer before posting mine
    Last edited by 4x2y; Aug 18th, 2017 at 08:58 PM.



  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2010
    Posts
    1,462

    Re: Printing to a Form

    Thanks very much Guys, the autodraw fixed everything
    Cheers - Alex

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