Remembering Variables
-
Hi, I have a program that opens an option form. For the options someone can basically list prices for various objects. I need to know how these prices can be remembered even after the program is shut down. I don't want to keep having to set the prices every time I run the program. Right now, I have a class which takes the prices and multiplies that by the quantity of an item. In that class I have static decimals. In the option form's button click I save a value to the class's static variables. Then I call those from the main form. Thanks for your help!
-
Hi, I have a program that opens an option form. For the options someone can basically list prices for various objects. I need to know how these prices can be remembered even after the program is shut down. I don't want to keep having to set the prices every time I run the program. Right now, I have a class which takes the prices and multiplies that by the quantity of an item. In that class I have static decimals. In the option form's button click I save a value to the class's static variables. Then I call those from the main form. Thanks for your help!
I hear there's this new thing called a database... :rolleyes: (If the number of "objects" is small and steady, perhaps an XML file will suffice.)
-
Hi, I have a program that opens an option form. For the options someone can basically list prices for various objects. I need to know how these prices can be remembered even after the program is shut down. I don't want to keep having to set the prices every time I run the program. Right now, I have a class which takes the prices and multiplies that by the quantity of an item. In that class I have static decimals. In the option form's button click I save a value to the class's static variables. Then I call those from the main form. Thanks for your help!
You can store it in any storage location like DataBase, TextFile . When program is restarting read the content from the storage location.
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
You can store it in any storage location like DataBase, TextFile . When program is restarting read the content from the storage location.
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Yeah, I pretty much feel like an idiot. I use a database for my asp.net apps, but for some reason it never occurred to me to use it for a windows form app. Anyway, thanks for the answer.
Ok so you have just added a new definition to not "thinking outside the box" - note the joke icon, this made me chuckle.
-
Hi, I have a program that opens an option form. For the options someone can basically list prices for various objects. I need to know how these prices can be remembered even after the program is shut down. I don't want to keep having to set the prices every time I run the program. Right now, I have a class which takes the prices and multiplies that by the quantity of an item. In that class I have static decimals. In the option form's button click I save a value to the class's static variables. Then I call those from the main form. Thanks for your help!
-
Hi, I have a program that opens an option form. For the options someone can basically list prices for various objects. I need to know how these prices can be remembered even after the program is shut down. I don't want to keep having to set the prices every time I run the program. Right now, I have a class which takes the prices and multiplies that by the quantity of an item. In that class I have static decimals. In the option form's button click I save a value to the class's static variables. Then I call those from the main form. Thanks for your help!
If your list is something that can be thought of as application settings , put it there. The application settings are easy to manage. Try to use but not abuse data bases (not even xml file dbs)
-
Hi, I have a program that opens an option form. For the options someone can basically list prices for various objects. I need to know how these prices can be remembered even after the program is shut down. I don't want to keep having to set the prices every time I run the program. Right now, I have a class which takes the prices and multiplies that by the quantity of an item. In that class I have static decimals. In the option form's button click I save a value to the class's static variables. Then I call those from the main form. Thanks for your help!