Wrox Programmer Forums
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 1st, 2004, 10:45 AM
Friend of Wrox
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default Multi Select Combo Box

Hi all

I need to ceate a multiselect combobox. For example, the user would like to hold down a key e.g Ctrl key and then select multiple values seperating them with a comma or something.

Any ideas?

Old March 1st, 2004, 10:59 AM
Friend of Wrox
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts

Can you use a list box instead of a combo box? List boxes support multiselecting.
Old March 1st, 2004, 03:09 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

Try this code (please add error handling:

Private Sub Combo1_Click()
    If m_bCrlIsDown Then
        Combo1.Text = Combo1.Tag & "," & Combo1.List(Combo1.ListIndex)
        Combo1.Text = Combo1.List(Combo1.ListIndex)
    End If
    Combo1.Tag = Combo1.Text
End Sub

To know if the Control key is down (m_bCrlIsDown in the above code) you can use the KeyDown, KeyUp event of the combo box, or better the GetAsyncKeyState API.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi Column Combo Box in Datagrid View Columns HemaChaudhry Visual Basic 2005 Basics 1 September 20th, 2007 07:51 AM
Combo Box to Show Multi Column Info After Select Coby Excel VBA 0 August 14th, 2007 05:23 PM
multi select open box dialog yourfriendahsan Visual Basic 2005 Basics 1 July 19th, 2007 02:49 PM
Multi-column combo box in datagridview aad1 C# 0 June 5th, 2006 09:58 AM
Multi Select List Box Coding Errors... snoopy92211 VB Databases Basics 10 June 30th, 2004 08:33 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.