Click here to Skip to main content
13,557,976 members
Click here to Skip to main content
Add your own
alternative version


48 bookmarked
Posted 6 Apr 2005

Multi-column Combo

, 6 Apr 2005
Rate this:
Please Sign up or sign in to vote.
A multi-column combo in VB.NET.


This is a simple multi-column combo having the facility to load data from a table, and sort the data in the combo by clicking the column header. In this UserControl, I have used Windows Forms controls (ComboBox and ListView) and a few lines of coding.

The properties and methods in this User Control are as follows:


  • ColumnSize

    Used to specify the column size of the combo.

  • ColumnTitle

    To specify the column title of the combo.

  • DataFieldList

    Used to store the data of a selected item.

    Example: in the demo combo, there are two columns, EmployeeCode and Name. When we select an item from the combo list, we want to store the employee code in the database and the name has to be displayed as a text in the control. This property is used to keep the employee code.

  • DataFieldToDisplay

    The item of the column to display in the control, after selection.

  • DataSource

    If we want to load the data from the database, we can make use of this property.


    Dim CnStr As String
    Dim Appcn As New System.Data.OleDb.OleDbConnection()
    Dim Da As New System.Data.OleDb.OleDbDataAdapter()
    Dim Ds As DataSet
    CnStr = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=D:\Data\Employee.MDB"
    Appcn = New System.Data.OleDb.OleDbConnection(CnStr)
    Da = New System.Data.OleDb.OleDbDataAdapter("Select * From Employee", Appcn)
    Ds = New DataSet("Combo")
    Da.Fill(Ds, "Combo")
    MulCol.DataSource = Ds.Tables("Combo")
  • ItemsToDisplay

    If we need to add some items to the combo not from the database, we can make use of this property. It’s a design time property. If we need more than one column, we have to separate them by comma (,). Example:


    In the above example, ‘RAC001’ is an employee code and RACHID is the employee name. So in the combo, it will come as two columns.

  • RowsToDisplay

    This is to specify how many rows are to be displayed in the drop down.

  • Text

    In this property, the selected item will be stores.

  • Value

    This property will store the value of ‘DataFieldList’.


  • AddItem

    This method is used to add items in the combo at run time. The columns have to be separated by comma (,). E.g.:


Property Page

How to use this control

Add this control into the project. Set the properties as mentioned above, in the property sheet. Place the following code in the form load event handler.

MulCol.LoadData() '---- This is the code to load the combo

Assume that the UserControl name is ‘MulCol’.

Note: If you are not going to load the data from the table, then don’t forget to add the data in the ‘ItemsToDisplay’ property. If you need to add more than one column, then separate the first item and the following items by a comma (,).

For more details, you can see the demo application. It’s a self explanatory one. And the user control also is a self explanatory one. And wherever comments are needed, I have placed the required comments too.


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

Web Developer
Kuwait Kuwait
I am J. Franklin Kennedy, Working as a programmer in application software developement.

You may also be interested in...

Comments and Discussions

QuestionNot able to download the source code or demo for Multi-column combo Pin
hdng7613-Jul-12 7:35
memberhdng7613-Jul-12 7:35 
Questionnice Pin
CIDev17-Feb-12 2:32
memberCIDev17-Feb-12 2:32 
GeneralFor Dual Column combobox, create the following: Pin
wsfaso28-Feb-11 8:55
memberwsfaso28-Feb-11 8:55 
GeneralMy vote of 4 Pin
Anil Dhir20-Oct-10 18:43
memberAnil Dhir20-Oct-10 18:43 
GeneralI am trying to let it work in MS SERVER Pin
RaghuDhanjal25-Sep-08 3:31
memberRaghuDhanjal25-Sep-08 3:31 
QuestionIssues with conrols Pin
pankajawasthi9911-Feb-07 10:17
memberpankajawasthi9911-Feb-07 10:17 
Generalabout the MultiColumn control Pin
suditur20-Dec-06 3:58
membersuditur20-Dec-06 3:58 
Generalembed in datagrid Pin
HemaRawat28-Dec-05 22:12
memberHemaRawat28-Dec-05 22:12 
QuestionI have a question? Pin
puvadols12-Oct-05 18:43
memberpuvadols12-Oct-05 18:43 
GeneralCombo Box Multi column Pin
TomKMathew11-Aug-05 18:22
memberTomKMathew11-Aug-05 18:22 
GeneralQn for Progress Bar Pin
TomKMathew11-Aug-05 18:17
memberTomKMathew11-Aug-05 18:17 
Questionlimited by form borders? Pin
quick_dry9-Aug-05 18:43
memberquick_dry9-Aug-05 18:43 
GeneralSetting Selection Pin
Danbw13-Jun-05 6:53
memberDanbw13-Jun-05 6:53 
QuestionCan i use this control in .net compact framework Pin
MaLong99826-May-05 5:38
memberMaLong99826-May-05 5:38 
GeneralDismiss droplist Pin
Brian Schallhammer26-May-05 3:59
sussBrian Schallhammer26-May-05 3:59 
GeneralOwner Drawn Columns Pin
Tom John5-May-05 7:25
memberTom John5-May-05 7:25 
QuestionEscape? Pin
ChefGroovy18-Apr-05 1:03
memberChefGroovy18-Apr-05 1:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web03 | 2.8.180515.1 | Last Updated 6 Apr 2005
Article Copyright 2005 by kennedy_franklin
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid