You are assigning the pointer to the stack based CString strFldName. It goes out of scope before the list is ever shown. Not to mention that they would all point to the same item.
If you use CArray< CString > that should work. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Monday, January 09, 2006 10:33 PM To: Palm Developer Forum Subject: Setting the list items runtime problem Hello EB, I want to set the item in list box at run time, what i have tried is below code snap. CListCtrl lstTest(FieldsList); arrChoices.SetCount(3); //declared as static CArray<const char*> arrChoices as a class variable for (Int8 nCount = 0; nCount < 3; nCount++) { CString strFldName ="Item1"; strFldName.Trim(); arrChoices[0] = strFldName; arrChoices[1]= strFldName; }//for lstTest.SetListChoices(arrChoices); but it still displays the garbage. is anything wrong with this code? Thanks in Advance Regards Amit -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
