I have form with many labels and textbox. All these generates a report .
I want to print it out in MS Word format and also set print privew.
Here is my code for print for single textbox but i don't print in MS word.
So what to do?

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

        Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
            Dim font1 As New Font("arial", 11, FontStyle.Regular)
            e.Graphics.DrawString(IDtxt.Text, font1, Brushes.Black, 100, 100)
        End Sub

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

Recommended Answers

All 3 Replies

sorry but this link is not opening.
Can u pl tell me another link

Create your report as a Word document using "Microsoft Word Object Library" (Microsoft.Office.Interop.Word).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.