473,772 Members | 3,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting the default printer

Hi, is there a way that i could get the default printer of the system? I'm
using VB.net 2001. There is a function in SDK called "GetDefaultPrin ter", but
i don't understand how to use it.

Nov 30 '05 #1
3 17185
"Panos" <Pa***@discussi ons.microsoft.c om> schrieb:
Hi, is there a way that i could get the default printer of the system? I'm
using VB.net 2001


See:

<URL:http://groups.google.d e/group/microsoft.publi c.dotnet.langua ges.vb/msg/654608b1fa80e21 9>

\\\
Imports System.Drawing. Printing
..
..
..

Private ReadOnly Property DefaultPrinterN ame() As String
Get
Dim ps As New PrinterSettings ()
Return ps.PrinterName
End Get
End Property
..
..
..
Dim DefaultPrinter As String = DefaultPrinterN ame
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 30 '05 #2
If you set PrinterName property to another printer, will this then become the
default printer after the application closes or does it revert to the
original default printer?
--
Dennis in Houston
"Herfried K. Wagner [MVP]" wrote:
"Panos" <Pa***@discussi ons.microsoft.c om> schrieb:
Hi, is there a way that i could get the default printer of the system? I'm
using VB.net 2001


See:

<URL:http://groups.google.d e/group/microsoft.publi c.dotnet.langua ges.vb/msg/654608b1fa80e21 9>

\\\
Imports System.Drawing. Printing
..
..
..

Private ReadOnly Property DefaultPrinterN ame() As String
Get
Dim ps As New PrinterSettings ()
Return ps.PrinterName
End Get
End Property
..
..
..
Dim DefaultPrinter As String = DefaultPrinterN ame
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 1 '05 #3
"Dennis" <De****@discuss ions.microsoft. com> schrieb:
If you set PrinterName property to another printer, will this then become
the
default printer after the application closes or does it revert to the
original default printer?


I don't think that it will change the system's default printer permanently.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 1 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
13026
by: Pablo | last post by:
Friends, how can i get the name of the default printer??. I'm working with winforms. VB,C#, nevermind. Thanks a lot Pablo
2
11349
by: Andy | last post by:
How do you set the default printer in C#? I have added a printer and now want to set that printer to the default. Listed below is my code, but I am getting an "Invalid method Parameter(s)" error on the 4th line: ManagementClass printerClass = new ManagementClass("Win32_Printer"); object printerName = {"\\\\REGWPROD\\REGW0951"}; object result = printerClass.InvokeMethod("AddPrinterConnection", printerName); result =...
3
3639
by: Geraldine Hobley | last post by:
Hello, How would you get and set the current default printer by using the system.drawing.printing class or any other class. Regards Geri
1
1449
by: Geraldine Hobley | last post by:
Hello, I have the following code that sets the default printer using the WMI (windows management system). ' Add a Reference to System.Management Dim moReturn As Management.ManagementObjectCollection Dim moSearch As Management.ManagementObjectSearcher Dim mo As Management.ManagementObject moSearch = New Management.ManagementObjectSearcher("Select * from
0
1616
by: Karthick_Microsoft | last post by:
Actually, in my ASP.Net application, i have a requirement of automatically changing the default printer. I did a OCX using VB and put it on the web page. The client machines do not have local printers but network printers (they have been mapped using Local Port pointing to \\machine\printer - this was suggested in a topic - for a reason that a network printer can be given a friendly name) - But when I click on Print from the browser...
1
5469
by: i8mypnuts | last post by:
Could someone please help? I am using the 'defaultprt.zip' tool provided by Ken Getz to change the default printer via VBA code (code below). My problem is that once the default printer has been changed, Access 2003 still directs the report to the former default printer. Access 2003 picks up the new default printer setting only after I have reopened the application. I have checked the default printer setting in the OS control panel and the...
5
2007
by: Glenn | last post by:
Hi We have a ASP.net app which calls into a web service which allow users to print stuff. At the moment they have to specify the printer. Apparently this is too much for our users, so I was wondering if there's a way of getting the default printer from their user profile? TIA Glenn
13
9086
by: Mark Rae | last post by:
Hi, I have used the code below to return the default printer in 32-bit WinXP Pro, but now that I am running 64-bit Vista Business I'm getting an error: using System.Drawing.Printing; using (PrintDocument objPrintDocument = new PrintDocument()) { string strDefaultPrinter =
0
2051
by: Tim | last post by:
Our application has used this PrintersClass module for some time without a problem but some new Toughbooks have caused problems. We use laser printers, usually the default choice, and some label printers. The label printers use the Seagull Scientific print drivers. The new notebooks will not print to the selected label printers even though the default printer for the report comes up in the dialog box as the selected printer. Even if you...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.