R
Robert
As I stated before, the Printer.print in VB 6.0
How do you print the following in VB.Net 2005
Public Function PrintVendorList()
'mdiMain.
'Print the List of Vendors.
Set rsCompany = New ADODB.Recordset
Set objCompany = New Acct08DLL.CCompany
Set rsPrint = New ADODB.Recordset
Set objPrint = New Acct08DLL.CCompany
Set rsPrint = objPrint.PrintVendors(mdiMain.stbar.Panels(9).Text)
Set rsCompany = objCompany.SelectCompany(mdiMain.stbar.Panels(9).Text)
If rsPrint.eof And rsPrint.BOF Then
Set rsPrint = Nothing
Set objPrint = Nothing
Set rsCompany = Nothing
Set objCompany = Nothing
Exit Function
End If
mdiMain.CMDialog1.CancelError = True
On Error GoTo PrintErr
mdiMain.CMDialog1.ShowPrinter
Printer.Orientation = vbPRORPortrait
Printer.PaperSize = vbPRPSLetter
Printer.Print
Printer.Print
Printer.FontBold = True
Printer.FontSize = 18
Dim x, y, A$, B$
Dim Counter
x = Printer.ScaleWidth / 2
A$ = "List of Vendors for " & rsCompany!CompName
B$ = "from " & App.EXEName
Printer.Font = "Courier New"
Printer.FontSize = 14
Printer.FontBold = True
Printer.CurrentX = x - Printer.TextWidth(A$) / 2
Printer.Print A$
Printer.CurrentX = x - Printer.TextWidth(B$) / 2
Printer.Print B$
Printer.Print
Printer.Print
' Printer.FontBold = False
' Printer.FontSize = 8
Counter = 1
Printer.Print Tab(1); "Row #"; Tab(9); "Vendor Name"
Printer.Print
Printer.FontBold = False
Printer.FontSize = 8
Do Until rsPrint.eof
Printer.Print Tab(5); Format(Counter, "000"); Tab(15); rsPrint!VName
'Printer.Print
Counter = Counter + 1
rsPrint.MoveNext
Loop
Printer.Print
Printer.FontSize = 8
Printer.FontBold = True
Printer.Print "Printed on " & Format(Now, "mmm dd, yyyy" & " @ " &
"hh:nn:ss ampm") & " from " & App.EXEName
Printer.FontBold = False
Printer.EndDoc
Set rsPrint = Nothing
Set objPrint = Nothing
Set rsCompany = Nothing
Set objCompany = Nothing
PrintErr:
If Err = cdlCancel Then
Exit Function
ElseIf Error = 0 Then
Exit Function
Else
Exit Function
End If
Exit Function
End Function
How do you print the following in VB.Net 2005
Public Function PrintVendorList()
'mdiMain.
'Print the List of Vendors.
Set rsCompany = New ADODB.Recordset
Set objCompany = New Acct08DLL.CCompany
Set rsPrint = New ADODB.Recordset
Set objPrint = New Acct08DLL.CCompany
Set rsPrint = objPrint.PrintVendors(mdiMain.stbar.Panels(9).Text)
Set rsCompany = objCompany.SelectCompany(mdiMain.stbar.Panels(9).Text)
If rsPrint.eof And rsPrint.BOF Then
Set rsPrint = Nothing
Set objPrint = Nothing
Set rsCompany = Nothing
Set objCompany = Nothing
Exit Function
End If
mdiMain.CMDialog1.CancelError = True
On Error GoTo PrintErr
mdiMain.CMDialog1.ShowPrinter
Printer.Orientation = vbPRORPortrait
Printer.PaperSize = vbPRPSLetter
Printer.Print
Printer.Print
Printer.FontBold = True
Printer.FontSize = 18
Dim x, y, A$, B$
Dim Counter
x = Printer.ScaleWidth / 2
A$ = "List of Vendors for " & rsCompany!CompName
B$ = "from " & App.EXEName
Printer.Font = "Courier New"
Printer.FontSize = 14
Printer.FontBold = True
Printer.CurrentX = x - Printer.TextWidth(A$) / 2
Printer.Print A$
Printer.CurrentX = x - Printer.TextWidth(B$) / 2
Printer.Print B$
Printer.Print
Printer.Print
' Printer.FontBold = False
' Printer.FontSize = 8
Counter = 1
Printer.Print Tab(1); "Row #"; Tab(9); "Vendor Name"
Printer.Print
Printer.FontBold = False
Printer.FontSize = 8
Do Until rsPrint.eof
Printer.Print Tab(5); Format(Counter, "000"); Tab(15); rsPrint!VName
'Printer.Print
Counter = Counter + 1
rsPrint.MoveNext
Loop
Printer.Print
Printer.FontSize = 8
Printer.FontBold = True
Printer.Print "Printed on " & Format(Now, "mmm dd, yyyy" & " @ " &
"hh:nn:ss ampm") & " from " & App.EXEName
Printer.FontBold = False
Printer.EndDoc
Set rsPrint = Nothing
Set objPrint = Nothing
Set rsCompany = Nothing
Set objCompany = Nothing
PrintErr:
If Err = cdlCancel Then
Exit Function
ElseIf Error = 0 Then
Exit Function
Else
Exit Function
End If
Exit Function
End Function