المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Listboxes, Strings And Arrays



C# Programming
09-06-2009, 04:01 PM
Hi,

I'm probably missing something really simple here, but i'm stuck.

Basically I have a listbox, which a user puts items into via a textbox and button, this works fine, the items go in.

Now, on exit the items save to a text file, this also works fine, ive checked all the items are contained in the text file. Now, when the user re-opens the application there is a button called load previous items, when i click this i have a streamreader reading the text document, also works fine, checked with a messagebox, and it saves it to the string

Now, I want the string to be saved into a array which is then put back into the textbox, the problem being, I dont know how to count the items in the string (each on a diffrent line) to put them into a array, and then after that I need a example of adding the array into my listbox.

Im guessing its something to do with the

listbox1.Addrange();

command.

Cheers,
Ben.