I'm generating random number values between 1 and 100 in 6 different listboxes in a 100ms timer. I want to save the items in the list boxes whenever i press a button to 6 different text files however i couldn't figure how to reach the items of a listbox to get them and save to a file. How do i do that?



You need to be more specific about the listboxes. Are they MFC's CListBoxes or generic Windows LISTBOXes or some other type of listboxes??

They are CListBoxes yes

To get the first listbox entry (assuming Listbox is a member variable)

CString str;
Listbox.GetText(0, str);

You can get the number of items in the listbox using Listbox.GetCount().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.