Hi,
i'm having problem with saving/retrieving last state of checkbox. to be more precise,all that i want is, when i run form the checkbox that is placed there have the same state as last time that the form has been run!...
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nilanka DharmadasaPosted Feb 1, 2010, 11:04 PM
If my answer helped, can you please spend a few seconds to tick 'Do you like this answer' checkbox. It helps me.
arbnor haliliPosted Feb 1, 2010, 8:14 PM
@niki d:a big thank for understanding me and a big thank for giving me a solution.
Jacob RPosted Feb 1, 2010, 2:45 AM
Nilanka DharmadasaPosted Feb 1, 2010, 2:19 AM
I don't think none of the above answers helped you.
I have a solution. It's easy. You can add a setting to your settings.settings file. It resides inside 'Properties' folder of your project. First you add a setting there. Then you use it to keep the checkbox state. You can set that value to checkbox state at the form load. When you change the checkbox state, the value of that setting is changed.
I have done everything in the code attached.
Please check my code.
Please do not forget to tick 'Do you like this answer' checkbox, if my answer helps.
Jacob RPosted Feb 1, 2010, 1:44 AM
With that having been said, every Object (ie. checkBox, textBox, comboBox ect..) that you can select from the toolbox will have a list of properties. Click on your checkbox to select it, look at the bottom right (VS 2008) and you will see a box marked "Properties". If it isn't there then click "View" from the top menu and then select "Properties Window". These are the different setting you can give your checkBox and like Sam said, there is one called "Checked" which is set to false by default. You can change that to true and it will always be checked when you run your program. Now to give the user some way to save if they want this box to be checked or unchecked then you will need to use some sort of way to store that data and then retrieve it when the program starts.
On another note, no one is here to teach you how to program using C# or any other language for that matter so I'll suggest a tutorial that I used when first started out. It is very nice and shouldn't confuse someone that is just starting. The link is http://www.homeandlearn.co.uk/csharp/csharp.html follow it from beginning to end and it will answer a lot of questions and give you a good foundation to build on. Good luck in your travels.
If I have offended you in any way about me assuming that your knowledge of C# and Visual Studio is at the beginner level then please don't take it to heart. I'm just here to help and get a few of my questions answered along the way.
Sam HobbsPosted Jan 31, 2010, 11:34 AM
arbnor haliliPosted Jan 30, 2010, 3:45 PM
Sam HobbsPosted Jan 30, 2010, 1:14 PM
arbnor haliliPosted Jan 30, 2010, 9:50 AM
Sam HobbsPosted Jan 29, 2010, 9:34 PM
Unless you are happy to accept any answer I give, even if you can't use it. Note that if anyone else gives you an answer, and it does not work for you, then it is because you did not specify what you need.
Whenever you ask a question such as this, in any forum or newsgroup, someone is going to ask you to calrify the question. It really helps to learn how to be more specific about what you need help with.