|
-
Jan 16th, 2004, 06:30 PM
#1
Thread Starter
Member
Print Preview control :(
Hey,
i really need to use the print preview function so i have assigned a command button so when it clicks it it will load up, but the thing is that nothing will show up. I change the properties (document bit) to the printdocument which i have created to print.
If anyone understand that can anyone help me?
thank you
sorry i am new at visual basic so i cant really go into major depth
-
Jan 17th, 2004, 12:27 AM
#2
Addicted Member
PrintPreviewDialog
Hi,
Dim PPreview As New PrintPreviewDialog()
PPreview.Document = PrintDocument1
PPreview.ShowDialog()
Have a nice day
-
Jan 17th, 2004, 03:20 AM
#3
Sleep mode
Originally posted by Ezpz
sorry i am new at visual basic so i cant really go into major depth
I suppose you are talking about Visual Basic.NET which is different than Visual Basic .
-
Jan 17th, 2004, 04:25 AM
#4
Thread Starter
Member
yes sorry visualbasic.net 
and no that code does not bring up items on my print preview 
the code i have used is this:
VB Code:
Dim WithEvents pdoc As Printing.PrintDocument
Private Sub pDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pDoc.PrintPage
e.Graphics.DrawString("Membership Name: " & dettxtnam.Text, New Font("Tahoma", 14), Brushes.Black, 15, 100)
e.Graphics.DrawString("Membership Number:" & dettxtnum.Text, New Font("Tahoma", 14), Brushes.Black, 15, 200)
e.Graphics.DrawString("Items List:", New Font("Tahoma", 14), Brushes.Black, 15, 300)
e.Graphics.DrawString(prodlst.Text, New Font("Tahoma", 14), Brushes.Black, 15, 400)
e.Graphics.DrawString("INVOICE", New Font("Tahoma", 15), Brushes.Black, 15, 500)
e.Graphics.DrawString("Total Before VAT: " & total.Text, New Font("Tahoma", 14), Brushes.Black, 15, 600)
e.Graphics.DrawString("VAT: " & totvat.Text, New Font("Tahoma", 14), Brushes.Black, 15, 700)
e.Graphics.DrawString("Final TOTAL " & total1.Text, New Font("Tahoma", 14), Brushes.Black, 15, 800)
End Sub
Dim PPreview As New PrintPreviewDialog
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PPreview.Document = PrintDocument1
PPreview.ShowDialog()
End Sub
so what am i doing wrong
Last edited by Ezpz; Jan 17th, 2004 at 04:29 AM.
-
Jan 17th, 2004, 10:31 AM
#5
Addicted Member
PrintPreviewDialog
Hi,
From the ToolBox drag and drop the PrintDocument1 on your form.
Name it pDoc like in your program
Private Sub pDoc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles pDoc.PrintPage
e.Graphics.DrawString("My Name is yulyos", New Font("Tahoma", 14), Brushes.Black, 15, 100)
'...
'...
'...
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim PPreview As New PrintPreviewDialog()
PPreview.Document = pDoc
PPreview.ShowDialog()
End Sub
Have a nice day
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|