Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey! I have a little problem. I want my program to remember what i last did when i start it again. Let's say i added some things to my listbox. This program is made for a game called runescape and i want to log some things i get from monsters so for example if i add this things:

1. coins
2. steel bar
3. Coal

If i now exit my program and start it again everything is empty. I want the program to remember what i last did so next time i start it, it will look exactly the same. Any tip?

[EDIT - moved from solution]
I've tried to save it and then open it again into the listbox. But the problem is that i have a "Drop rate" so when i add items it says like this: drop rate: 50% and when i open the text file into the listbox again it start with 100% again even if it's 25% on another exactly same item. I also have "charm" drop as it's called so if i get charms in drop it says like this:

Gold charm 40
Green charm 20
Crimson charms 50
Blue charms 10

they also disappear when i restart the program and i don't know how to load them into the labels again. And if i load them it probably would start over again from 0.
[/EDIT]
Posted
Updated 17-Mar-13 22:13pm
v2
Comments
Maciej Los 18-Mar-13 4:16am    
Gramas19,
Please, use "Improve question" widget to update your question, rather than "Add a Solution".

You need to bind data to your listbox.
Data Binding a Windows Forms Combobox or ListBox[^]
Data Binding Overview[^]

You can use My.Settings object to.
My.Settings Object[^]
Managing Application Settings[^]
 
Share this answer
 
You can save your data(like listbox rows)in a txt file.
Remember that you should save data in close event of windows form and recall txt file and use that in form load event.
For each row in list box you can go to next line txt file or use a character like '$'.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900