|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
How to create multi-column combo box in vb.net? Hi, How to create multi-column combo box in vb.net? This combo box should have 2 or more columns like that! |
#2
| |||
| |||
Re: How to create multi-column combo box in vb.net? This is a simple example of how to display table values (i.e. multiple columns) in a combo box. For the dropdown window, a form with a ListView docked to fill can be used. The MultiColumnCombobox class is inherited from the System.Windows.Forms.Combobox class. Code: protected override void OnDropDown(System.EventArgs e){ Form parent = this.FindForm(); if(this.dataTable != null || this.dataRows!= null){ MultiColumnComboPopup popup = new MultiColumnComboPopup(this.dataTable, ref this.selectedRow,columnsToDisplay); popup.AfterRowSelectEvent+= new AfterRowSelectEventHandler (MultiColumnComboBox_AfterSelectEvent); popup.Location = new Point(parent.Left + this.Left + 4 ,parent.Top + this.Bottom + this.Height); popup.Show(); Code: multiColumnComboBox1.Table = dtable;//DataTable //Column to display after selection multiColumnComboBox1.DisplayMember = "Band"; multiColumnComboBox1.ColumnsToDisplay = new string[]{"Band","Song","Album"};//columns to display //in the dropdown grid I hope this helps you! |
#3
| |||
| |||
Re: How to create multi-column combo box in vb.net? If U have ur field names as follows: Firsname Lasname ,ID U need to know that, There 're two types of combo box 1. A combo box -Normal 2. a data combo Thee First one, u will have it as yo will have to decare a recordset to select Firstname, lastname and a id from the table that house those records: eg dim rst as new adodb.recordset dim conn as new adodb.connection conn.open("dsn=datasourcename") set rst = conn.execute ("select Firstname, lastname ,Id from tablename ") do until rst.eof combo1.Additem rst!firstname +' '+ rst!Lastname +' ' rst!ID rst.movenext loop The second one uses Ado data control Where u will have the Ado datacontrol selecting as thus: select firstname +' '+ rst!Lastname +' ' rst!ID from tablename i hope u will get it |
![]() |
|
Tags: multicolumn combo box, vb dot net |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Create button to navigate to next blank cell in a column | Brad B | MS Office Support | 1 | 21-02-2012 12:10 AM |
How to create a multi column drop down list in Microsoft Excel | RYAN$ | MS Office Support | 4 | 28-01-2012 03:45 PM |
How to print content of a Multi column Listbox? | Bryant | Software Development | 6 | 27-07-2011 11:48 AM |
Combo box multi selection | SoftWore | Software Development | 2 | 12-11-2009 02:15 PM |