Solved

Populate a combo box with installed printers

Posted on 2009-07-09
2
287 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

770 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