Question By obtaining prints print queue

karim orooji

New member
Joined
Jul 15, 2014
Messages
1
Programming Experience
Beginner
Hi to all friends
As is characteristic of the post I took the time to print a print queue for my display number plates
With this code, I've chosen to print submissions
VB.NET:
 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick        Dim searchPrintJobs As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_PrintJob")
        Dim jobs As ManagementObjectCollection = searchPrintJobs.Get
        For Each job As ManagementObject In jobs
            Dim str_list(3) As String
            str_list(3) = (job.Properties("Document").Value.ToString)
            str_list(2) = (job.Properties("size").Value.ToString + "KB ")
            str_list(1) = (job.Properties("TotalPages").Value.ToString)
            str_list(0) = (ManagementDateTimeConverter.ToDateTime(job.Properties("TimeSubmitted").Value))
            Dim itm As New ListViewItem(str_list)
            ListView1.Items.Add(itm)
            remove_empty_row()
        Next
    End Sub
 Sub remove_empty_row()
        Dim i As Integer = 0
        While i < ListView1.Items.Count
            If CStr(ListView1.Items.Item(i).Text) = "" Then
                ListView1.Items.RemoveAt(i)
            Else
                i += 1
            End If
        End While
        For Row As Int16 = 0 To ListView1.Items.Count - 2
            For RowAgain As Int16 = ListView1.Items.Count - 1 To Row + 1 Step -1
                If ListView1.Items(Row).ToString = ListView1.Items(RowAgain).ToString Then
                    ListView1.Items.RemoveAt(RowAgain)
                End If
            Next
        Next
    End Sub
After closing the program twice to open the correct information was displayed
 

Attachments

  • ss.jpg
    ss.jpg
    111.8 KB · Views: 25
  • count print yor clint.zip
    67.7 KB · Views: 21
Last edited:
Is there a question in there?

By the way, I have deleted your attachment because it contained binary files, which is against the rules. If you're going to ZIP up a project to attach, make sure that you delete the `bin` and `obj` folders first. Attaching full projects should only ever be a last resort anyway.
 
Back
Top