PrintQueue.Refresh Method ()


Updates the properties of the PrintQueue object with values from the printer and the print queue utility that runs on the computer.

Namespace:   System.Printing
Assembly:  System.Printing (in System.Printing.dll)

Public Overrides Sub Refresh

Exception Condition

Some of the properties could not be refreshed.

Changes your program makes to a PrintQueue object's properties are lost when Refresh executes, unless they have been written to the printer and print queue with Commit.

The following example shows how to use this method as part of a survey all printers for possible error status.

' Survey queue status for every queue on every print server
Dim line As String
Dim statusReport As String = vbLf & vbLf & "Any problem states are indicated below:" & vbLf & vbLf
line = fileOfPrintServers.ReadLine()
Do While line IsNot Nothing
	 Dim myPS As New PrintServer(line, PrintSystemDesiredAccess.AdministrateServer)
	 Dim myPrintQueues As PrintQueueCollection = myPS.GetPrintQueues()
	 statusReport = statusReport & vbLf & line
	 For Each pq As PrintQueue In myPrintQueues
		 statusReport = statusReport & vbLf & vbTab & pq.Name & ":"
		 If useAttributesResponse = "y" Then
			 TroubleSpotter.SpotTroubleUsingQueueAttributes(statusReport, pq)
			 ' TroubleSpotter class is defined in the complete example.
			 TroubleSpotter.SpotTroubleUsingProperties(statusReport, pq)
		 End If

	 Next pq ' end for each print queue

	line = fileOfPrintServers.ReadLine()
Loop ' end while list of print servers is not yet exhausted

Console.WriteLine(vbLf & "Press Return to continue.")

.NET Framework
Available since 3.0
Return to top