Results 1 to 3 of 3

Thread: [RESOLVED] e.HasMorePages don't work

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Resolved [RESOLVED] e.HasMorePages don't work

    Hi,

    Can someone tell me why the e.HasMorePages = True in the code below don't work
    I need to print the word Aetek in a new page.
    Code:
    Private Sub PrintDocument1_PrintPage...
    
    e.Graphics.DrawString("Makor", DrawFont, DrawBrush, x, y, RTL_Alignment)
    
            e.HasMorePages = True
    
    e.Graphics.DrawString("Aetek", DrawFont, DrawBrush, x, y, RTL_Alignment)
    
            e.HasMorePages = False
    
    End Sub
    Thanks in advance

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: e.HasMorePages don't work

    You need to have a global variable to tell the PrintPage event handler what to print on each page...
    Some thing like this
    Code:
    Private printItem As Integer '<<< the global variable
    
    'And when you call printdocument.Print, you do this
    printItem = 0
    PrintDocument1.Print()
    
    'And then in your printpage sub, you check that global variable
    Private Sub PrintDocument1_PrintPage...
    
    If printItem = 0 Then
         e.Graphics.DrawString("Makor", DrawFont, DrawBrush, x, y, RTL_Alignment)
         printItem += 1   '<<< Increment the printItem variable
         e.HasMorePages = True
    Else
         e.Graphics.DrawString("Aetek", DrawFont, DrawBrush, x, y, RTL_Alignment)
         e.HasMorePages = False
    End If
    
    End Sub
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: e.HasMorePages don't work

    Hi,

    Thanks working good

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