steelnaaz 0 Newbie Poster

i have a format for printing and it is in excelsheet format.i am using microsoft visual studio 2005 in that vb.net as language.in my project there is a print button and on clicking that i want that printing must be done in that specific format only.also want to show the print preview i tried the following code but its just printing in simple format :-
'ASimple PrintPage Event Handler
Private Sub PrintDocument1 PrintPage(
ByVal sender As Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs)
Handles PrintDocument1.PrintPage
Static pageNum As Integer
Dim prFont As New Font(”Verdana”, 24, GraphicsUnit.Point)
e.Graphics.DrawString(
”PAGE ” & pageNum + 1, prFont,
Brushes.Black, 700, 1050)
e.Graphics.DrawRectangle(Pens.Blue, 0, 0, 300, 100)
e.Graphics.DrawString(
”Printing with VB 2005”, prFont,
Brushes.Black, 10, 10)
’ Add more printing statements here
’ Following is the logic that determines whether we’re done printing
pageNum = pageNum + 1
If pageNum <= 3 Then
e.HasMorePages = True
Else
e.HasMorePages = False
pageNum = 0
End If
End Sub

also for print dialog box code i have added is :

PrintDialog1.PrinterSettings = PrintDocument1.PrinterSettings
If PrintDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
PrintDocument1.PrinterSettings = PrintDialog1.PrinterSettings
End If

but this is just doing just simple printing.how to print in a specific format ????please help if anyone knows.