2 Replies - 587 Views - Last Post: 24 April 2012 - 10:56 AM Rate Topic: -----

#1 kingns007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 24-April 12

facing problem with e.hasmorepages.

Posted 24 April 2012 - 04:54 AM

When i am using e.hasmorepages in the following code it is giving a single page print with overlapped. i mean it is overlapping the contents of other pages in 1st page. please tell me wat to do?
Dim Obstectric_History As String
                Obstectric_History = dr.Item(6)
                Dim words() As String = Obstectric_History.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
                Dim lineList As List(Of String) = New List(Of String)
                Dim line As String = ""
                For Each word As String In words
                    If (line.Length + word.Length + 1) < 10 Then
                        line = line & " " & word
                    Else
                        If (yang11 >= 300) Then
                            e.HasMorePages = True
                            yang11 = 270
                        Else
                            e.HasMorePages = False
                        End If
                        e.Graphics.DrawString(line, ft1, Brushes.Black, 125, yang11)
                        yang11 = yang11 + 20
                        lineList.Add(line)
                        line = word
                    End If
                Next



Is This A Good Question/Topic? 0
  • +

Replies To: facing problem with e.hasmorepages.

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1397
  • View blog
  • Posts: 4,494
  • Joined: 25-September 09

Re: facing problem with e.hasmorepages.

Posted 24 April 2012 - 06:57 AM

Try remarking out the
Else
   e.HasMorePages = False

lines

What I THINK might be happening is that it is hitting that line even though you have more lines but that is telling the printpage that it is the last page and then you're continuing to draw.

I admit I struggle with the logic of the HasMorePages method but what I do know is, when e.HasMorePages=True, the printpages is ran from the beginning so any intialization of variables are reinitialized.
Was This Post Helpful? 0
  • +
  • -

#3 kingns007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 24-April 12

Re: facing problem with e.hasmorepages.

Posted 24 April 2012 - 10:56 AM

its not working.......
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1