Solved

Populate a combo box with installed printers

Posted on 2009-07-09
2
291 Views
Last Modified: 2012-05-07
I have had a look around for this and although it does seem possible i cant seem to find it. I am using VB2005.net and i want to populate a combobox with a list of installed printers. How can i do it.
Most things i have read say start with DIM DEV as PRINTER but printer is not avaliable as an option

Any ideas as this is urgent
0
Comment
Question by:bostonste
2 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 24813815
Loop through the PrinterSettings.InstalledPrinters collection adding the printers to a ComboBox
http://www.vb-helper.com/howto_net_list_printers.html
Imports System.Drawing.Printing
 
Private Sub Form1_Load(ByVal sender As Object, ByVal e As _
    System.EventArgs) Handles MyBase.Load
    Dim pkInstalledPrinters As String
 
    ' Find all printers installed
    For Each pkInstalledPrinters In _
        PrinterSettings.InstalledPrinters
        cboInstalledPrinters.Items.Add(pkInstalledPrinters)
    Next pkInstalledPrinters
 
    ' Set the combo to the first printer in the list
    cboInstalledPrinters.SelectedIndex = 0
End Sub

Open in new window

0
 

Author Closing Comment

by:bostonste
ID: 31601600
Thank you that was perfect
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question