H Dale,
As for the referencing question you mentioned, as Mark has explained.
For those classes that you only need to put "using XXXXX namespace " above
the code, that is because the namespace is defined within an assembly your
project has already referenced. for example, the .net project by default
references several assemblies when you create the project such as:
mscorelib.dll
system.dll
system.data.dll..
....
For System.Management namespace, it is defined in another separate
assembly, therefore, you need to manually import it into your project's
reference list so that the IDE can get sense of any namespace of classes in
that assembly(the intellisense will work then).
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?QnJhc3NpY2FOaWdyYQ==?= <br************@community.nospam>
References: <CB**********************************@microsoft.co m>
<un**************@TK2MSFTNGP02.phx.gbl>
>Subject: Re: Server Printing using Print Dialog
Date: Wed, 9 Jul 2008 07:50:01 -0700
>
Mark,
I figured out the System.Management namespace issue. One question about
this; normally I do not have to add a reference when using any of the
system
>namespace items - usually just putting the 'using System.XXXX' at the top
of
>the file is all I have to do. Why did I have to add a reference for this
one.
>
Thanks for your help.
Dale
"Mark Rae [MVP]" wrote:
>"BrassicaNigra" <br************@community.nospamwrote in message
news:CB**********************************@microso ft.com...
How can I bring up a print dialog box in the client browser that
offers
the
different printers available to the server?
You can't. Calling a dialog box on the server would pop a dialog box on
the
>server - there will be no-one there to see it...
If that is not possible, is there a way to retrieve the names of the
printers on the server. I could then use the PrintSettings.PrinterName
property to set the output myself
Certainly. Because the code will be running on the server, you have the
entire .NET Framework at your disposal. There are several ways you can
retrieve the collection of printers installed on the server, but WMI is
probably the simplest:
using System.Collections.Generic;
using System.Management;
using (ManagementObjectSearcher objMOS = new
ManagementObjectSearcher("SELECT * FROM Win32_Printer"))
{
using (ManagementObjectCollection objMOC = objMOS.Get())
{
foreach (ManagementObject objMO in objMOC)
{
// do something with objMO["Name"]
}
}
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net