IntroductionAfter searching for a MultiColumn ComboBox with configurable view columns, configurable display & value members, I decided to create my own control.The Multi-Column ComboBox is a combination of TextBox, Button & DataGridView control. Since I had a need to create a control like a ComboBox and with search functionality, I decided to use DataGridView & it's filter criteria for fast search functionality. One of the harder things to figure out was what container to show on key press of the combo control. I used ToolStripDropDown as a host control for DataGridView to show the ComboBox popup on key press. Common Properties:
private DataTable GetDataSource(){ DataTable dtSource = new DataTable(); DataColumn dtColID = new DataColumn("ID"); dtColID.DataType = System.Type.GetType("System.String"); dtSource.Columns.Add(dtColID);
DataColumn dtColName = new DataColumn("Name"); dtColName.DataType = System.Type.GetType("System.String"); dtSource.Columns.Add(dtColName);
DataColumn dtColCode = new DataColumn("Code"); dtColCode.DataType = System.Type.GetType("System.String"); dtSource.Columns.Add(dtColCode);
//Add rows DataRow row = dtSource.NewRow(); row[dtColID] = "1"; row[dtColName] = "Vijay"; row[dtColCode] = "1001"; dtSource.Rows.Add(row);
//Add rows row = dtSource.NewRow(); row[dtColID] = "2"; row[dtColName] = "Ajay"; row[dtColCode] = "1002"; dtSource.Rows.Add(row); . . . . . . . . . .
return dtSource;}
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: