Here is the sample code you can use to print your data from the bas module:
Module modMain
Dim sText As String
Public Sub printRecord()
Dim pDocument As New Printing.PrintDocument
AddHandler pDocument.PrintPage, AddressOf pd_PrintPage
sText = "DotNet Blogger - Your favorite Microsoft Visual Studio .Net Programming Blog."
pDocument.Print()
End Sub
Private Sub pd_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
'this uses a module level variable
e.Graphics.DrawString(sText, New Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Pixel), Brushes.Black, 50, 50)
End Sub
End ModuleTested with VS 2008
If you found any issues with the code posted above, please leave a comment. We will fix the code as soon as possible.