I'm transferring a number of values from an Array to an OLE grid control (XGrid). The OLE object requires the value to be passed as typr VARIANT which I initialized as follows :

// Initialize Variables
int row, col;
tagVARIANT CellValue;
::VariantInit(&CellValue);



A Number of loops loads each column based on a user selection. Each column is either of type CString or int but they all need to be converted to type VARIANT which works ok for type int

// Load Skill Ability->Skill
col = 3;
for(row=2;row<SKILL_COUNT;row++)
{
CellValue.intVal = GetDocument()->m_Skills.GetSkillAbilitySkill(row-1);
m_XGrid4.TargetCell(row, col);
m_XGrid4.SetValue(CellValue);
}



For my CString columns I get the following message : <'binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no acceptable conversion)>. I tried a number of types for VARIANT including bstrVal, cVal etc.

Thank you for you suggestions.

Pras