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?
long generating report
Collapse
X
-
No its ok here......Originally posted by ot1Shouldn't you have posted this in the .net Forum???
in should not be taking so long..... would you mind posting your codeComment
-
and in PrintPreviewDia log1 properties -document set to PrintDocument1Code: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 ClassComment
-
-
ok what i dont like about your code is the dim g as graphicsOriginally posted by jeferand in PrintPreviewDia log1 properties -document set to PrintDocument1Code: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
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
Comment