Here is a sample printing

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
 
A

Armin Zingler

Robert said:
As I stated before, the Printer.print in VB 6.0

How do you print the following in VB.Net 2005

See the PrintDocument class as mentioned in the other thread.


Armin
 
R

Robert

Once again, Nothing happens with the sample, execpt 10 errors.

Upgrade to this .Net seems like a total waste of time and money.

Simple Printer.print
What ever came upon Microsoft to change such a simple task.
 
L

Lloyd Sheen

Robert said:
Once again, Nothing happens with the sample, execpt 10 errors.

Upgrade to this .Net seems like a total waste of time and money.

Simple Printer.print
What ever came upon Microsoft to change such a simple task.

I don't have a printer attached to this workstation but if I add a reference
to Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 then all the
commands you are issuing should be available.

LS
 
T

Terry

Hi Robert,
Welcome to the wonderful world of printing in .Net! I got to this point
a few weeks ago where I needed to do some printing in my first .Net app. and
expierenced a lot the the frustration you are right now. If you want to
print the 'old fashioned' way - then you need to download and install the
power pack that some one mentioned earlier. Another choice is to use Crystal
Reports. The documentation sucks, but if you are determined, you can get
some decent results w/o much work (other then the learning curve, which I am
still on). Then there is the PrintDocument class! And yes, it seems like it
is only good for printing a text file at first glance. The trick to making
it usefull is building your own class which inherits from it. Here is a link
that describes the approach.

http://msdn.microsoft.com/msdnmag/issues/03/02/printinginnet/

Good Luck,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top