using System.Management;
private ManagementObjectSearcher query;
private ManagementObjectCollection queryCollection;
string _classname="SELECT * FROM Win32_Printer";
query=new ManagementObjectSearcher(_classname);
queryCollection = query.Get();
foreach (ManagementObject mo in queryCollection)
{
if (string.Compare(mo["Name"].ToString(),PrinterName,true)==0)
{
mo.InvokeMethod("SetDefaultPrinter",null);
break;
}
}
------------------------------------------------------------------
ListViewItem lvi = new ListViewItem(mo["Name"].ToString());
this.listView1.Items.Add(lvi);