long generating report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jefer
    New Member
    • Feb 2008
    • 6

    long generating report

    I'm using PrintPreviewDia log in vb2005 and it takes 1min to generate report with a single word.. is it vb bug or what? is there anything to make thing faster?
  • ot1
    New Member
    • Mar 2008
    • 2

    #2
    Shouldn't you have posted this in the .net Forum???

    Originally posted by jefer
    I'm using PrintPreviewDia log in vb2005 and it takes 1min to generate report with a single word.. is it vb bug or what? is there anything to make thing faster?

    Comment

    • daniel aristidou
      Contributor
      • Aug 2007
      • 494

      #3
      Originally posted by ot1
      Shouldn't you have posted this in the .net Forum???
      No its ok here......
      in should not be taking so long..... would you mind posting your code

      Comment

      • jefer
        New Member
        • Feb 2008
        • 6

        #4
        Code:
        Public Class Form1
            Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
                Dim g As Graphics = e.Graphics
                Dim message As String = System.Environment.UserName
                Dim messageFont As New Font("Arial", 24,System.Drawing.GraphicsUnit.Point)
                g.DrawString(message, messageFont, Brushes.Black, 100, 100)
            End Sub
        
            Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                PrintPreviewDialog1.ShowDialog()
            End Sub
        End Class
        and in PrintPreviewDia log1 properties -document set to PrintDocument1

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          That also might be because of your system configuration.

          Comment

          • jefer
            New Member
            • Feb 2008
            • 6

            #6
            none of other programs have problems with that..
            printing operation also takes one minute

            Comment

            • daniel aristidou
              Contributor
              • Aug 2007
              • 494

              #7
              Originally posted by jefer
              Code:
              Public Class Form1
                  Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
                      Dim g As Graphics = e.Graphics
                      Dim message As String = System.Environment.UserName
                      Dim messageFont As New Font("Arial", 24,System.Drawing.GraphicsUnit.Point)
                      g.DrawString(message, messageFont, Brushes.Black, 100, 100)
                  End Sub
              
                  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                      PrintPreviewDialog1.ShowDialog()
                  End Sub
              End Class
              and in PrintPreviewDia log1 properties -document set to PrintDocument1
              ok what i dont like about your code is the dim g as graphics
              instead use the with property
              [CODE=vb] Dim message As String = System.Environm ent.UserName
              Dim messageFont As New Font("Arial", 24,System.Drawi ng.GraphicsUnit .Point)
              with e.graphics
              .DrawString(mes sage, messageFont, Brushes.Black, 100, 100)
              End Sub
              End with
              [/CODE]

              Comment

              Working...