Visual Basic .NET Forums    

Go Back   Visual Basic .NET Forums > Components & Controls > Reporting / Printing

VB.NET Forums Newsletter Signup:
Email address:


Reporting / Printing Discussion on output-creation components such as reporting, pdf, etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-01-2008, 5:45 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Nov 2008
Posts: 1
Reputation: 0
niea_186 is on a distinguished programming path ahead
Default need help with this(printdocument method)

hi, i'm new here and new at VB.net. I just want to ask why this is happening to me. I'm doing a short report for my program and i suppose to print it out using printdocument. my problem is, i can't get my VB print to the second page. I've done a lot of research but in the end my coding just print out the same page over and over again.

eg suppose VB print out the second page but it print out page 1 again without printing out the second page.

this is my coding

Code:
    Private Sub PrintDocument_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument.PrintPage
        Dim printFont As New Font("Times New Roman", 12)
        Dim headingFont As New Font("Century Gothic", 14, FontStyle.Bold)
        Dim headingFont1 As New Font("Century Gothic", 16, FontStyle.Bold)
        Dim lineHeightSingle As Single = printFont.GetHeight + 30
        Dim horizontalPrintLocationSingle As Single = e.MarginBounds.Left
        Dim verticalPrintLocationSingle As Single = e.MarginBounds.Top
        Dim printLineString As String

        printLineString = "Malay Cultural Club, University College Sedaya International" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont1, Brushes.Black, horizontalPrintLocationSingle, _
        verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        printLineString = "Introduction" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, _
        verticalPrintLocationSingle)
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, _
        verticalPrintLocationSingle)

        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "The Malay Culture Club of University College Sedaya International was recently revived on " & ControlChars.NewLine _
        & "28th January, 2007. The objective of this club is to introduce the Malay culture to the students " & ControlChars.NewLine _
        & "of University College Sedaya International and the club is opened to all students of University " & ControlChars.NewLine _
        & "College Sedaya International regardless of their race and nationality. 
        e.Graphics.DrawString(printLineString, printFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Event Name" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Date/Time/Vanue of Event" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)

        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Date  : " & ControlChars.NewLine & "Time  : " & ControlChars.NewLine & "Vanue : "
        e.Graphics.DrawString(printLineString, printFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle

        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        verticalPrintLocationSingle += lineHeightSingle
        printLineString = "Goals/Objective" & ControlChars.NewLine & " "
        e.Graphics.DrawString(printLineString, headingFont, Brushes.Black, horizontalPrintLocationSingle, verticalPrintLocationSingle)
        verticalPrintLocationSingle += lineHeightSingle


        --this part not sure--
        if pageCounterInteger <= 4 Then
        e.HasMorePages = True
        Else
        e.HasMorePages = False
        pageCounterInteger = 1
        End If

    End Sub
my not sure how to use the HasMorePages coding
please ignore some of the coding because this is only sample and it is not complete. i just want to see either my coding works or not .

Please help me with this problem
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 4:47 AM.




Click to advertise here

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
For advertising opportunities click here.