Adding 40 strings to 20 combobox should NOT take much time; there must be some other issues somewhere.
You should at least have an array with the ID of each combobox (or maybe an array of the combobox themselves) for quicker access.
I just tried something like this, and it seems to be working fine.
const int numberOfStrings = 40;
CString arrayOfString[numberOfStrings ];
const int numberOfComboBox = 20;
UINT arrayOfId[numberOfComboBox ];
for ( unsigned int comboIndex = 0; comboIndex < numberOfComboBox; comboIndex++ )
{
CComboBox* combo = (CComboBox*) GetDlgItem( arrayOfId[comboIndex] );
for (unsigned int stringIndex = 0; stringIndex < numberOfStrings; stringIndex++
{
combo->AddString(arrayOfString[stringIndex]);
}
}
But as Richard wrote, there should be a better way of doing what you want to do without have to have 20+ combo in a single form.
Max.