Important alert: (current site time 7/15/2013 9:12:38 AM EDT)
 

winzip icon

Flat-Multicolumn combobox with autocomplete

Email
Submitted on: 11/1/2004 5:21:30 AM
By: Claudio Di Flumeri  
Level: Advanced
User Rating: By 26 Users
Compatibility: VB.NET
Views: 82730
 
     Me and my colleague Massimiliano Silvestro have developed a combobox control derived from the base combobox supplied with VS.NET. This combobox has some interesting features like - Multiple Column (for now, max 4) with configurable widths - Flat look similar to the XP combobox - Highlight combobox border and arrow on MouseEnter and GotFocus events - Autocomplete text written in the text area, basing on first column values - Overriden DropDownStyle property to manage autocomplete feature with DropDownList style - Loading the combobox via MTGCComboboxItem or through a DataTable - Custom colors for border (highlighted and not), arrow, dropdownlist grid etc. - Custom designer used to disable/enable properties at design time, managing verbs etc. In the attached .zip file you will find the source code of the control, a simple application that shows the features of the control, am html file with some examples on how to load data in the combobox. Have a look and let me know what you think!

 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
// for :Flat-Multicolumn combobox with autocomplete
//**************************************
'-------------------------------------------------------------------
' *****************************
' * MTGCComboBox for .NET *
' ***************************** 
'
' Copyright © 2004, MT Global Consulting srl. All rights reserved
' Version: 1.0.0.0
' Developed by: Claudio Di Flumeri, Massimiliano Silvestro
' Web Site: http://www.mtgc.net
' e-mail: claudio@mtgc.net
'
' You may include the source code, modified source code, assembly
' within your own projects for either personal or commercial use
'
' 
' Disclaimer: 
' This code is provided as is and without warranty, written or implied.
'-------------------------------------------------------------------
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
11/2/2004 8:20:30 AMTom Malone

Very nice project. Thanks for sharing this.
(If this comment was disrespectful, please report it.)

 
11/10/2004 1:50:36 AMSana Khan

Yes, it's really a nice code ... Thanks for sharing it :)
I hope you will continue to post good topics ... But please, make some intermediate level codes available too :)
(If this comment was disrespectful, please report it.)

 
12/15/2004 4:12:22 AMAnkurgarg

Looks good,
worth the efforts !!

Thumbs up

(If this comment was disrespectful, please report it.)

 
5/4/2005 2:43:53 AM

Excellent, work.
Congratulations.
(If this comment was disrespectful, please report it.)

 
6/28/2005 12:04:08 PM

nice code...one question though...is he ValueMember property supposed to work? I can't get it to work for me
(If this comment was disrespectful, please report it.)

 
7/28/2005 2:19:14 AM

is this compatible to VS.net 2002?
(If this comment was disrespectful, please report it.)

 
9/28/2005 7:12:55 AMHema Chaudhry

Thanx To Place such a nice code with many functionality
(If this comment was disrespectful, please report it.)

 
12/21/2005 9:06:57 AM

Hi,
really nice to see. Just learning VB.NET and I am having an issue when trying to access the 'SelectedItem.col1' the col1 method is not exposed and gives me an error message.
combo loaded from datatable and columns appear as desired but when i want to use the selected row's column data I cannot seem to get at them.
' Areas
'
dtAreas.Columns.Add("Area_ID", System.Type.GetType("System.String"))
dtAreas.Columns.Add("Description", System.Type.GetType("System.String"))

daAreas1.Fill(dtAreas)

mccbAreas.SelectedIndex = -1
mccbAreas.Items.Clear()
mccbAreas.LoadingType = MTGCComboBox.CaricamentoCombo.DataTable
mccbAreas.SourceDataString = New String(1) {"Area_ID", "Description"}
mccbAreas.ColumnWidth = "50" & ";" & "200"
mccbAreas.SourceDataTable = dtAreas
Dim str1 As String

str1 = mccbAreas.SelectedItem.col1()

Any help would be much appreciated.
JPN
(If this comment was disrespectful, please report it.)

 
1/14/2006 7:14:56 AMsachinThamke

Hi
It's greate component u have developed. i m having one problem, just i want to know can we show the tooptip to show the value of selected item. Because i m having item with more width.

Thinking for positive replay
Thanks
(If this comment was disrespectful, please report it.)

 
1/30/2006 4:42:04 PMTrisha

can i use this control on ASP.NET??
(If this comment was disrespectful, please report it.)

 
2/20/2006 2:07:39 AMrizwan

can i use this control on ASP.NET Plz reply ??

(If this comment was disrespectful, please report it.)

 
4/5/2006 9:41:49 AMtlb

Could you convert it for C#?
(If this comment was disrespectful, please report it.)

 
4/28/2006 9:13:48 PMEdward Brown

Hi,

I love this combo box but how can I change the displaymember so that after the selection is made the combo will show "CA" instead of "California". In other words, I want to show a a column other than the first.
(If this comment was disrespectful, please report it.)

 
9/21/2006 12:52:52 PMSikanderMandal

It's a nice combobox. Good Features in it. But there is a problem of Bound Column how do i Bound Column(BoundText). If there is same two records with same name but having differ code. i.e. (1. NAME="ABC", CODE="001" 2. NAME="ABC", CODE="002")

if I wanna Select Second with Code "002" How Do I Select. When the Code Column is after Name Columns"


Help on this.


Sikander



(If this comment was disrespectful, please report it.)

 
11/6/2006 5:12:00 PM

Why can't you move or resize this control when it resides in a group box on a tab control?
(If this comment was disrespectful, please report it.)

 
1/21/2007 8:55:59 AMMukhtar

Good Program. Thank you
(If this comment was disrespectful, please report it.)

 
12/13/2007 5:51:03 AMfiwi463pfa

I just discovered the nice looking and working multicolumn combobox.

I wondered if there is a way to show the value of the SECOND column ?

I have data as this
A Name1
A Name2
B Name3
C Name4

Col1 is the working shift
Col2 is the worker.

I'd really like to have the shiftcode first...
(If this comment was disrespectful, please report it.)

 
1/15/2009 4:33:36 AMBerre

Hi Claudio,
I just found this post and it was very usefull! It works perfectly! I have only 1 question: Is it also possible to use images in one of the columns? I have 4 columns, an ID, a description and 2 yes/no columns. It would be nice if I could display them like a checkbox or something. Or maybe a green/red circle... But I can't find an option to add an image-column. Thx in advance!
(If this comment was disrespectful, please report it.)

 
3/30/2010 1:53:09 AMSewraj

Dear Sir Gdmrng, first of all thanks for your valuable code that you provided,its really SUPERB.Well i need your help.1st while including the .dll file in the Project i completely lost it after having included it once.2nd i have the same problem as Sikander that is if the first columns data repeats then how to select from the combobox where the first column data matches EXACTLY with the second column
E.g
Column1 column 2
Description Type
MILK REDCOW 1 kg
MILK REDCOW 2 kgs


Regards
Sewraj

(If this comment was disrespectful, please report it.)

 
11/23/2010 2:37:47 PMAngie

Hello,
This control is very nice, and I converted it to work in .NET 4.0. I've run into a problem that seems to be with Microsoft's combobox in general, and I'm wondering if you've come across this at all.

I created a .NET 4.0 project, deployed it to Windows 7 and Windows XP SP2, and all was well. Recently I installed my project on an XP SP3 machine. On that PC, this control and Microsoft's control have both stopped working. The forms without any comboboxes still work fine.

When the main screen first loads, an error displays with "System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length". Other user actions result in error "System.NullReferenceException: Object reference not set to an instance of an object." I'm completely baffled as to why it only shows a problem on XP SP3.

Have you come across this at all? Any suggestion you can make would be appreciated!
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.