ComboBox - More than one Column
-
Does anyone know whether you can have more than one Column in a CComboBox ? Seen this in an Access App. If yes: how to do ? Modified: Meant Column rather that row ! -- modified at 7:20 Monday 20th March, 2006
What do you mean by more that one row in a combo box?
Nibu thomas Software Developer
-
What do you mean by more that one row in a combo box?
Nibu thomas Software Developer
All right: a ComboBox keeps al lot of items listed while opened. I used ComboBoxes a lot so far. It´s content could look like this, just one row is keept by ComboBox Element and displayed: Fred Harry Paul Thomas I seen this in ACCESS in a different shape: 1 Fred 2 Harry 3 Paul 4 Thomas ACCESS is capable of holding more than one row in a ComoBox Element.
-
All right: a ComboBox keeps al lot of items listed while opened. I used ComboBoxes a lot so far. It´s content could look like this, just one row is keept by ComboBox Element and displayed: Fred Harry Paul Thomas I seen this in ACCESS in a different shape: 1 Fred 2 Harry 3 Paul 4 Thomas ACCESS is capable of holding more than one row in a ComoBox Element.
RadioOpa wrote:
I seen this in ACCESS in a different shape: 1 Fred 2 Harry 3 Paul 4 Thomas
It is easy to display strings like this... When you add an item make sure you get the index to the item and then use
CString's
Format
function.CString str;
str.Format("%02d Fred", nIndex);
m_cmb.AddString(str);//this should do it.Well to create multicolumn list box use
LBS_MULTICOLUMN
.
Nibu thomas Software Developer
-
RadioOpa wrote:
I seen this in ACCESS in a different shape: 1 Fred 2 Harry 3 Paul 4 Thomas
It is easy to display strings like this... When you add an item make sure you get the index to the item and then use
CString's
Format
function.CString str;
str.Format("%02d Fred", nIndex);
m_cmb.AddString(str);//this should do it.Well to create multicolumn list box use
LBS_MULTICOLUMN
.
Nibu thomas Software Developer
Thanks, but this is not a ListBox but a ComboBox. In a ListBox you can easily create more than one column and select items and it´s columns as m_Liste.InsertColumn( 0, "ID"); m_Liste.SetColumnWidth( 0, 40 ); m_Liste.InsertColumn( 1, "Customer"); m_Liste.SetColumnWidth( 1, 160 ); m_Liste.InsertColumn( 2, "Country"); m_Liste.SetColumnWidth( 2, 40); It appears that ComboBoxes do not support this feature so I need to format the string as suggested. I´ll use CString members as mid... for getting what I´m after.
-
Thanks, but this is not a ListBox but a ComboBox. In a ListBox you can easily create more than one column and select items and it´s columns as m_Liste.InsertColumn( 0, "ID"); m_Liste.SetColumnWidth( 0, 40 ); m_Liste.InsertColumn( 1, "Customer"); m_Liste.SetColumnWidth( 1, 160 ); m_Liste.InsertColumn( 2, "Country"); m_Liste.SetColumnWidth( 2, 40); It appears that ComboBoxes do not support this feature so I need to format the string as suggested. I´ll use CString members as mid... for getting what I´m after.
Yeah. You are right. Subclass the combobox. And then get hold of the list box inside the combo using
OnCtlColor
(See my reply to NS17 down). Now modify the style of the list box. Set it to haveLBS_MULTICOLUMN
style.
Nibu thomas Software Developer
-
Does anyone know whether you can have more than one Column in a CComboBox ? Seen this in an Access App. If yes: how to do ? Modified: Meant Column rather that row ! -- modified at 7:20 Monday 20th March, 2006
http://www.codeproject.com/combobox/SuperComboBox.asp[^] maybe it is some helpful to you