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

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • Hybrid cloud platforms need to think in terms of sweet spots when it comes to application platform interface (API) integration. Cloud Velocity has taken a unique approach to tight integration with the API sweet spot; enough to support the agility of physical and virtual apps, including multi-tier environments and databases, while reducing capital and operating costs. Read this case study to learn how a global-level Fortune 1000 company was able to deploy an entire 6+ TB Oracle eCommerce stack in Amazon Web …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds