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

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds