here is my entire code:
Code:
Imports System.Data.OleDb

Public Class Form1

    Dim con As OleDbConnection

    Dim cmd As OleDbCommand

    Dim da As OleDbDataAdapter

    Private _titleFont As Font

    Private _detailFont As Font

    Private Sub PrintDocument1_BeginPrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs) Handles PrintDocument1.BeginPrint
        'set the data pointers (if any) to the start position
        'initialise any page number variables you might have

        _titleFont = New Font(FontFamily.GenericSerif, 16, FontStyle.Bold, GraphicsUnit.Point)

        _detailFont = New Font(FontFamily.GenericSerif, 9, FontStyle.Bold, GraphicsUnit.Point)

    End Sub

    Private Sub PrintDocument1_EndPrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs) Handles PrintDocument1.EndPrint
        'You can use this event handler to clear up any objects that you have created for the print job
    End Sub

    Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        'All of the actual printing on a page is done in the PrintPage event handler
        'This event is raised for each page that is printed
        'the drawing and text commands that you code in this event handler control what is printed on the page itself

        Dim xPos As Single = 20

        Dim yPos As Single = 20

        Dim i As Integer = 0

        For Each rows As DataRow In dt.Rows

            e.Graphics.DrawString(dt.Rows(i).Item(0).ToString, _detailFont, Brushes.Black, xPos, yPos)

            xPos += e.Graphics.MeasureString(dt.Rows(i).Item(0).ToString, _detailFont).Width

            e.Graphics.DrawString(dt.Rows(i).Item(1).ToString, _detailFont, Brushes.Black, xPos, yPos)

            xPos += e.Graphics.MeasureString(dt.Rows(i).Item(1).ToString, _detailFont).Width

            e.Graphics.DrawString(dt.Rows(i).Item(2).ToString, _detailFont, Brushes.Black, xPos, yPos)

            xPos += e.Graphics.MeasureString(dt.Rows(i).Item(2).ToString, _detailFont).Width

            e.Graphics.DrawString(dt.Rows(i).Item(3).ToString, _detailFont, Brushes.Black, xPos, yPos)

            xPos = 20

            yPos += 20

            i += 1

        Next

    End Sub

    'if there are more pages to print, set the e.HasMorePages property to True
    'and the QueryPageSettings and PrintPage events will be triggered again
    'the same event handler is used, so if you want to print different pages
    'you need to keep track of which page you are on and code your PrintPage event handler accordingly

    Dim dt As New DataTable
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

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

            PrintDocument1.Print()

        End If

    End Sub

    Private Sub PrintDocument1_QueryPageSettings(ByVal sender As Object, ByVal e As System.Drawing.Printing.QueryPageSettingsEventArgs) Handles PrintDocument1.QueryPageSettings
        'raised before each and every page that is printed
        'use this event to set any page settings for the next page to be printed
        'set the orientation (landscape or portrait), the paper size, paper source, and so on

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        PrintPreviewDialog1.Document = PrintDocument1

        PrintPreviewDialog1.ShowDialog()

    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        con = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=db1.mdb")

        con.Open()

        cmd = New OleDbCommand("Select * from Table1 where Roll='31'", con)

        da = New OleDbDataAdapter(cmd)

        da.Fill(dt)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        PageSetupDialog1.PageSettings = PrintDocument1.DefaultPageSettings

        If PageSetupDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then

            PrintDocument1.DefaultPageSettings = PageSetupDialog1.PageSettings

        Else

            Exit Sub

        End If

    End Sub

End Class
the print preview dialog works greta but i am having simple problem:
have a look at this image:
Name:  Untitled.jpg
Views: 485
Size:  4.1 KB

The leftmost print button will print the document and as soon as i click it,the printing begins.

All i want to do is to display the print dialog to it as soon as the leftmost print button is clicked an then i want to start the printing when the print button of the print dialog is clicked.

But i dont know if there is some event to do this or some other ideas.....

Please help

thank you