i had developed an application which contain dialog selection list. This application is developed on series 60 sdk FP2
I have written list box dialog in resource. And adding the cdescarry object to the CAknSelectionListDialog and run. but when i am running the application at the time of displaying listbox dialog, the program is going to crash.

TInt index;
TBuf<30> buffer;
CDesCArray * array= new(ELeave ) CDesCArrayFlat(5);

// Add the device infor to the array.
for(index = 0; index < 5; index++ )
_LIT(KFormat, "\tItem\t%d");
buffer.Format(KFormat, index);
index = 0;
CAknSelectionListDialog* dialog = CAknSelectionListDialog::NewL (index, array, 0);

/* CAknDialog * dialog;
dialog = new(ELeave) CAknDialog();
dialog->ExecuteLD(R_SAMPLIST_DIALOG); */

when i am running the application using CAKnSelectionListDialog, it says, program closed stop and crashed it.
if suppose i am using CAknDialog, it is display the list box with contens which are defined in resource file as ARRAY.
but, i want to add the contents dynamically for that i am using CAKnSelectionListDialog.
the below also related to resource file.

RESOURCE DIALOG r_samplist_dialog
flags = EAknDialogSelectionList | EEikDialogFlagWait;
items =
type = EAknCtSingleListBox;
id = ESampList;
control = LISTBOX
flags = EAknListBoxSelectionList;
// array_id = r_mylistbox_items;

please anybody tell me what is the exact problem.
otherwise is there any other way to add dynamically contents to the list box.