ADO DOT NET
Centurion
- Joined
- Dec 20, 2006
- Messages
- 160
In VB6.0 I was using this:
To print the contents of a text box via a printer.
That was OK and simple!
But now in VB.NET 2005:
Because I am new to .NET, I just want to know if I am doing everything allright?
I want to know if my code is based on a true procedure?
And it won't case an error to occur?
Thanks all the people
Visual Basic:
Printer.Print(TextBox1.Text)
That was OK and simple!
But now in VB.NET 2005:
Visual Basic:
Private Sub PrintLogButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintLogButton.Click
Try
PrintDialog.Document = PrintDocument
If PrintDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
PrintDocument.Print()
End If
Catch Exception As Exception
End Try
End Sub
Private Sub PrintDocument_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument.PrintPage
e.Graphics.DrawString(ReportTextBox.Text, New Font("Arial", 10, FontStyle.Regular), Brushes.Black, 20, 20)
End Sub
I want to know if my code is based on a true procedure?
And it won't case an error to occur?
Thanks all the people