Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

problem related to CComboBox in VC++

preetimcapreetimca Member Posts: 1
my code is
CString info[MAX_PRESENCE_INFO]={"I Am Happy","Busy","Angry",
"I Am In Meeting","I Am at work"};
for(int i=0;i<MAX_PRESENCE_INFO;i++)
{
MyComboBox.AddString(info[i]);
}


when i wrote this code in the Oninitdialog() it goes abort the application
or when i wrote this in the Onpaint() it also goes abort
i work on MFC & UNICODE
MyComboBox is the Control of CCombobox .......can u suggest me the when this MYComboBox is created

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [code][black]
    PCHAR items [ MAX_PRESENCE_INFO ] =
    {
    "I Am Happy",
    "Busy",
    "Angry",
    "I Am In Meeting",
    "I Am at work"
    };

    for (int i = 0; i < MAX_PRESENCE_INFO ; i++)
    {
    MyComboBox.AddString (items [i]);
    }
    [/black][/code]
    [blue]Use simple character pointer to add constant strings to a combobox. The control will be ready in OnInitDialog() method. It depends on how this variable is declared? (is it inside dialog class header file?) and does it uses DDX macros to subclass it? (search your cpp file for this 'MyComboBox')

    P.S. For unknown reason the [italic]MAX_PRESENCE_INFO[/italic] turns into [italic]max_presence_info[/italic] when it is used inside the array declarator - bug in the forum code.[/blue]
Sign In or Register to comment.