You can see the MS sample : https://github.com/cubika/OneCode/tree/master/Visual%20Studio%202008/CSWinFormMultipleColumnComboBox
How to Display multiple columns in WinForms combobox?
Kerry Ou
226
Reputation points
This picture is Access 2010.Data come from SQL. I tried to move to Winform. I know how to bind data sources.
Can WinForms combobox do the same? Show 3 columns and titles, When a row is selected, return only Plan_no.
I am new, maybe I need more detailed examples or code. Thank you so much.
Accepted answer
1 additional answer
Sort by: Most helpful
-
Karen Payne MVP 35,401 Reputation points
2023-03-22T10:15:23.53+00:00 See the following article with code..
Mock-up example
private void Form1_Load(object sender, EventArgs e) { DataTable dataTable = new DataTable("Employees"); dataTable.Columns.Add("EmployeeID", typeof(int)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Designation", typeof(string)); dataTable.Rows.Add(1, "Natalia", "Developer"); dataTable.Rows.Add(2, "Jonathan", "Developer"); dataTable.Rows.Add(3, "Jake", "Developer"); dataTable.Rows.Add(4, "Abraham", "Developer"); dataTable.Rows.Add(5, "Mary", "Team Lead"); dataTable.Rows.Add(6, "Calvin", "Project Manager"); dataTable.Rows.Add(7, "Sarah", "Team Lead"); dataTable.Rows.Add(8, "Monica", "Developer"); dataTable.Rows.Add(9, "Donna", "Developer"); multiColumnComboBox1.DataSource = dataTable; multiColumnComboBox1.DisplayMember = "Name"; multiColumnComboBox1.ValueMember = "EmployeeID"; } private void CurrentButton_Click(object sender, EventArgs e) { int id = ((DataRowView)multiColumnComboBox1.SelectedItem).Row.Field<int>("EmployeeID"); }