Click here to Skip to main content
Licence 
First Posted 6 Oct 2005
Views 100,287
Bookmarked 53 times

Auto Complete Multi Column ComboBox

By | 6 Oct 2005 | Article
This is my version of an auto completing mutli column ComboBox.

Sample Image

Introduction

I have seen a few other multi column combo boxes and auto complete combo boxes so I decided to submit this code that does both.

Background

A while ago I needed to move a project from MS Access to C#. In Access it was using a lot of their nifty columned combo boxes and our customers would struggle mightily if there were any changes to this functionality. Thus the ColumnComboBox was born.

Using the code

This class can be used like any other ComboBox except the Items should be set using the Data property. This is a DataTable from which the ColumnComboBox gets all the data for filling the drop down box. Simply fill a DataTable as desired and then set the Data property with it.

//set the Data of the ColumnComboBox
myColumnComboBox.Data = myDataTable;

You can then set the column that will be displayed as the text of the combo box.

//set the ViewColumn
myColumnComboBox.ViewColumn = 2;

Any columns that you don't want to display in the drop down can be hidden like this:

//Set a few columns to not be shown
myColumnComboBox.Columns[1].Display = false;
myColumnComboBox.Columns[3].Display = false;

There are a few other properties to play with such as being able to turn auto complete off (myColumnComboBox.Suggest = false;) or an indexer for getting values from columns at the current rows.

Points of Interest

The code uses a few helper classes that are included either below the ColumnComboBox class or in another included file (StringList). The source for the ColumnComboBox is commented if you want to poke around yourself. I for one will be happier when/if they get templates into C#.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

cavoliotmail.com1@h



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionCystral report calculation Pinmemberkwamebounty21:45 24 Jan '12  
QuestionAdding a new header for each Columns PinmemberMember 32156010:32 11 Jan '12  
GeneralMy vote of 5 Pinmemberfariborz sadighi23:32 12 Apr '11  
GeneralSelectedIndex issue [Solved] Pinmemberimpy2:05 12 Jun '10  
GeneralRe: SelectedIndex issue [Solved] PinmemberRedDude10:57 8 Mar '11  
QuestionHow can I show the column name PinmemberNelio Sotomayor5:39 9 Dec '09  
Questionhow to use in datagridview Pinmembermkhalid00711:11 9 Jul '09  
Generalcolumn headers Pinmemberarevans6:07 19 Nov '08  
GeneralRe: column headers Pinmemberewansw4:43 30 Dec '08  
Generalget only one value PinmemberJM ® - DE CASTRO3:22 30 Apr '08  
GeneralRTL PinmembernETbKA4:34 19 Apr '07  
GeneralRe: RTL Pinmembercavoli15:12 19 Apr '07  
GeneralRe: RTL PinmembernETbKA22:37 21 Apr '07  
GeneralRe: RTL Pinmembercavoli14:01 23 Apr '07  
GeneralIndexed items with sorted list Pinmemberdave.kelly21:11 28 Feb '07  
GeneralRe: Indexed items with sorted list Pinmembercavoli15:05 1 Mar '07  
GeneralRe: Indexed items with sorted list Pinmemberdave.kelly20:55 1 Mar '07  
GeneralRe: Indexed items with sorted list Pinmembercavoli15:14 1 Mar '07  
GeneralSet Selected Index Pinmembersalah_gis23:35 21 Feb '07  
GeneralRe: Set Selected Index Pinmembercavoli15:13 1 Mar '07  
QuestionMouse pointer dissapears Pinmemberfonk66610:01 8 Feb '07  
AnswerRe: Mouse pointer dissapears Pinmembercavoli14:00 9 Feb '07  
AnswerRe: Mouse pointer dissapears Pinmembersanrio55512:50 13 Mar '07  
GeneralRe: Mouse pointer dissapears PinmemberRedDude10:55 8 Mar '11  
GeneralI can't find the control in my toolbox Pinmemberbigwill34349:35 10 Dec '06  
Hi there.
 
This control is just what i am looking for. But i can't test it, because i can find it in my toolbox. (using vs2005).
 
I have added the project to my solution and adden the project as a referance.
 
In my toolbox i can se the "MultiColumnComboSuggestionBox", but no controls in the group.
 
Any ideas on how i can get this thing to work ?
 
Thanks.
 
Lars E.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 6 Oct 2005
Article Copyright 2005 by cavoliotmail.com1@h
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid