I have problem in printing i send the print but the blank page comes code i am using as follows:

Dim linesPerPage As Single = 0
        Dim yPosition As Single = 0
        Dim count As Integer = 0
        Dim leftMargin As Single = e.MarginBounds.Left
        Dim topMargin As Single = e.MarginBounds.Top
        Dim printFont As Font = Me.Font
        Dim myBrush As New SolidBrush(Color.Black)
        'Dim text() As String = TextBox1.Lines
        Dim text() As String = New String() {TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text, TextBox6.Text, TextBox7.Text, TextBox8.Text, TextBox9.Text}
        linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics)
        Try
            For i As Integer = 0 To text.Length - 1
                If count < linesPerPage Then
                    yPosition = topMargin + (count * printFont.GetHeight(e.Graphics))
                    e.Graphics.DrawString(text(i), printFont, myBrush, leftMargin, yPosition, New StringFormat())
                    count += 1
                Else
                    Exit For
                End If
            Next
        Catch ex As Exception
        End Try
        e.HasMorePages = True
        e.HasMorePages = False
        myBrush = Nothing

What happens during debugging?
Does the code step into the For...Next iteration?
What's the size of linesPerPage and yPosition?
Does the code reach the line e.Graphics.DrawString(...) ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.