What error do you get ?
Another possibility (example in a combobox)
Source: http://www.vb-helper.com/h
Main Topics
Browse All TopicsThis is in vb .net 2008 and I want to populate a listview in a list output but I cant seem to split it into an array or don't know how to
Any help please
I have been using this website
http://www.codeproject.com
In conjunction with a conversion site which is
http://www.developerfusion
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
What error do you get ?
Another possibility (example in a combobox)
Source: http://www.vb-helper.com/h
CodeCruiser can you ellaborate ( post full code as confused what your explaining - sorry ! )
<<-- Newbie to vb 2008 so what you said here
Change the function to use a List(of String) instead of stringcollection. Change the return type of the function as well as the type of the printerNameCollection variable.
Means nothing to me
This will most likely be messy in terms of coding as am a total newbie as aformentioned but I was originally using below code to enumerate one list view with device name and port type ie ip address, usb etc
In effect I basically want the printers listview with numerous columns ie
Device Name | Connection Type | Number of Jobs | Status |
--------------------------
Printer 1 IP_192.168.1.24 0 Online - Ready
Printer 2 USB 1 Online - Printing
etc
When I click on one of the printers in the list view I want a 2nd listview where it will populate the 2nd listview with pending print jobs with relevant info mentioned below
Document Name | Owner | Submitted | Connection Type | Number of Jobs | Status | Size
--------------------------
Print Job One User 1 Date & Time IP_192.168.1.24 0 Online - Ready N/A
Print 2 User 1 Date & Time USB 1 Online - Printing 10Mb
etc
Wanting to be able to cancel print jobs, pause and resume and cancel ALL print jobs as well and this util will have the option to connect to a print server or run locally on client machines so hence why I have the code below with the select case to either use wmi for local connection and remote connection with authentication etc
Also I appreicate that the above is a full program and a lot of code but just a bit stuck on how to collate the information in the querries to be able to populate the information into the listview so if we could focus on the printers one and see how thats done I could most likely transfer similiar code to the print jobs one but may still need help porting a few bits and pieces from C# to vb .net 2008 as per the link on the code project website which I linked to in the question
I explained it above but basically If I enumerate the printers as per above example that you posted then I have issues with getting the other columns populated with the other info from the WMI querries ie ip address, username, size of print job etc etc as per the above post here
13/08/09 01:48 PM, ID: 25087541
I have tried to retrieve the list of all the properties of a printer. You can get the ConnectionType using the PortName property which returns the IP address (i could not test USB as no usb printer on my laptop). The Status property has an integer value so needs to be mapped to a string. You can use a DataTable to store all this data and keep updating it. I could not see current job count but there is a property JobsSinceLastReset. Once you have the list of printers in datatable, you can update other columns using other WMI classes.
Getting 2 error messages
Error 1 'items' is not a member of 'System.Data.DataRow'. C:\vb 2008 current\Printer_Management
Error 2 Name 'queuedjobs' is not declared. C:\vb 2008 current\Printer_Management
I have also imports System.Data.DataRow
Thats where I am getting stuck because I don't know how to intergrate more then one WMI querry into this data table because the queued job names you get from the win32_PrintJob class where as win32_Printer is a totally different wmi class and I don't get how to combine the two together so that I can do the following
where queuedjobs is the result(s) from the win32_PrintJob class with respect to the actual queued Jobs in the selected printers print queue
Just as a heads up have re asked the question as stuck with this data table issue
http://www.experts-exchang
Business Accounts
Answer for Membership
by: CodeCruiserPosted on 2009-08-13 at 03:33:59ID: 25086824
Change the function to use a List(of String) instead of stringcollection. Change the return type of the function as well as the type of the printerNameCollection variable.
Then in the code you can use that list of strings as follows
Dim mylist as List(of String) = GetPrintersCollection()
For Each s as string in mylist
ListView1.Items.Add(s)
Next