Fill a combobox with current defined printers

Add this code to an empty form with a combobox or list box on it:
private Sub Form_Load()
    Combo1.Clear
    m_GetPrinters Combo1
    Combo1.ListIndex = 0

End Sub

'-----------------------------------------------------------------
' looking for all printers and filling objListOrCombo
'-----------------------------------------------------------------
public Sub m_GetPrinters(byref objListOrCombo as Object)
    Dim objPrinter          as Printer
    Dim intNbOfPrinters     as Integer

    intNbOfPrinters = Printers.Count - 1
    for Each objPrinter In Printers
        objListOrCombo.AddItem objPrinter.DeviceName
    next
End Sub


Comments

  • Thanks

    Posted by Legacy on 03/04/2003 12:00am

    Originally posted by: Tim Ryan

    great code
    thank you

    Reply
  • filling combo box with printers

    Posted by Legacy on 01/12/2002 12:00am

    Originally posted by: Baksh

    i was actually amazed with the code because . i came to this site through a search engine.i was actually thinks i would take me at least 1/2 hr job to find this source , but i got it in one single click

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • In support of their business continuity and disaster recovery plans, many midsized companies endeavor to avoid putting all their eggs in one basket. Understanding the critical role of last-mile connectivity and always available Internet access for their enterprises, savvy firms utilize redundant connections from multiple service providers. Despite the good intentions, their Internet connectivity risk may still be in a single basket. That is because internet service providers (ISPs) and competitive local …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds