|
-
Jun 8th, 2008, 10:16 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2008] Printer.Print in 2008
what is the equivalent method in VB.NET 2008 for printer.print in VB6
thanks,
Last edited by erickwidya; Jun 11th, 2008 at 09:07 PM.
-
Jun 8th, 2008, 11:10 PM
#2
Re: [2008] Printer.Print in 2008
There is no easy equilivalent. You have to do all the printing yourself. Use the PrintDocument control/object which will give you the "canvas" on which to print.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 8th, 2008, 11:38 PM
#3
Thread Starter
Fanatic Member
Re: [2008] Printer.Print in 2008
thx RD
I already explore PrintDocument Object, it seem need File as an input while Printer.Print just directly print it
-
Jun 9th, 2008, 03:14 AM
#4
Re: [2008] Printer.Print in 2008
Printer.Print is a VB 6 method and the whole print architechure in .NET is completely different. You will not find a managed code colution as simple as Printer.Print
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 9th, 2008, 05:18 AM
#5
Re: [2008] Printer.Print in 2008
If you are migrating a VB6 solution that uses Printer.Print then I'd suggest adding the Microsoft Visual Basic Power Packs 3.0 which enables straigh-forward Printer.Print type code.
However for a new application I would recommend using the .NET framework printing methods as they are far far far more powerful than Printer.Print - there is a beginners guide that I wrote here...
-
Jun 9th, 2008, 07:41 PM
#6
Re: [2008] Printer.Print in 2008
I would strongly advise against using utilities or packs that allow the use of legacy VB 6 code in .NET as you will never learn as much or be able to take advantage of the power of the framework.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 10th, 2008, 02:24 AM
#7
Thread Starter
Fanatic Member
Re: [2008] Printer.Print in 2008
i agree with RD,
if still want to use Classic then don't use .NET but thanks for the info Merrion, i will keep it in mind
You will not find a managed code colution as simple as Printer.Print -> yes, very hard to understand at first but i come up with a solution, not try print yet but it found the Default Printer
Code:
Dim oPrintDocument As New PrintDocument
AddHandler oPrintDocument.PrintPage, AddressOf PrintDocument_PrintPage
Private Sub PrintDocument_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
' Create font and brush.
Dim drawFont As New Font("Arial", 10)
Dim drawBrush As New SolidBrush(Color.Black)
' Create point for upper-left corner of drawing.
Dim drawPoint As New PointF(150.0F, 150.0F)
' Draw string to screen.
ev.Graphics.DrawString("TESPRINT", drawFont, drawBrush, drawPoint)
End Sub ' PrintDocument_PrintPage
Last edited by erickwidya; Jun 10th, 2008 at 03:10 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|