Help, please....

I am a newbie in C++. In an MFC dialog, I put an Edit control and a List box. I want to populate the List box (m_List) with strings derived from the Edit box string.

- in the dialog's OnInitDialog, I tried to put

GetDlgItemText (..) // get text from Edit box
process the string //
m_List.AddString (..) // etc. several strings
m_List.SetCurSel (..) //

but GetDlgItemText could not work from OnInitDialog.

- When I put the above code in OnOK, the ListBox is populated for a fraction of seconds and soon disappear.

I have read the MSDN library, and tried other events (OnKillFocus, etc.) but could not get the dialog to stop to display the strings in the List Box. What should I do ? ...