I created an app for calculation of an HVAC equipment. Everything is OK (My last question in this app) but i'm facing with a new problem. When i click the print button and then select the printer, print preview dialog shows me the printer selection dialog's traces.
I tried sleep function at different rows but it doesn't work. How can i fix my app ? Here is my code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Visible = False
ComboBox1.Visible = False
PrintDialog1.PrinterSettings = PrintForm1.PrinterSettings
PrintDialog1.AllowSomePages = True
If PrintDialog1.ShowDialog = DialogResult.OK Then
Thread.Sleep(3000)
With Me.PrintForm1
PrintForm1.PrinterSettings = PrintDialog1.PrinterSettings
.PrintAction = Printing.PrintAction.PrintToPreview
Dim MyMargins As New Margins
With MyMargins
.Left = 40
.Right = 40
.Top = 40
.Bottom = 40
End With
.PrinterSettings.DefaultPageSettings.Margins = MyMargins
PrintForm1.DocumentName = notasyon_lbl.Text
.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.CompatibleModeClientAreaOnly)
End With
End If
Me.Close()
End Sub