3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Dheerajpro
1

Drag a printdocument to the form and add this.

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

Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

    e.Graphics.DrawString(TextBox1.Text, Me.Font, Brushes.Black, e.MarginBounds.Location)

End Sub

You have to write your own printing logic. This prints 1 line of text starting at the printers margins.


If this solves your problem mark it as solved, otherwise say why it didn't solve your problem.

Votes + Comments
Solved :)
0

thanks this works but what i should do when i want to print hole table inside the datagrid view

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.