请问在vb.net中如何检测打印机是否安装或是否激活?
------解决方案--------------------
if (System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count <= 0)
{
MessageBox.Show( "没找到打印机 ");
}
------解决方案--------------------
如下的代码检测当前安装的所有打印机可用信息:
Private Sub button1_Click(ByVal sender As Object,ByVal e As EventArgs)
If (PrinterSettings.InstalledPrinters.Count <= 0) Then
MessageBox.Show( "没找到打印机 ")
End If
Dim ps As New PrinterSettings
Dim printName As String
For Each printName In PrinterSettings.InstalledPrinters
ps.PrinterName = printName
Console.WriteLine( "默认打印机:{0}; 是否可用:{1} ",1} ",ps.IsDefaultPrinter,ps.IsValid)
Next
End Sub
文章转载自:http://www.myexception.cn/vb-dotnet/187104.html
原文链接:https://www.f2er.com/vb/258003.html