Incrementing question

PAffiliates

Member
Joined
Aug 15, 2007
Messages
10
Programming Experience
Beginner
Hello, I just signed up to the forum. I am a beginner working on a small application that requires a field called "Serial" to increment every time the Print Labels button is pressed. I am aware of how to do this while the form is active, but I need this value to be saved and displayed when the program is closed and then started again. I was thinking about trying to write the value to a text file with the streamwriter/streamreader method. Every time the button is pressed, it would calculate the increment, delete the old number, and replace it with the new incremented number. This doesn't seem like the best method to use. If anyone can help me through this, I would greatly appreciate it. Thank you all for your time.

PS...I have no idea how i would delete the old line if the method I described was the most desireable.
 
Create a user setting for this. In project properties, Settings tab write a new line, call your setting "counter", set Integer as its type, "user" scope (as default). Also go to Application tab and make sure the "save my.settings on exit" checkbox is enabled (default too). Now you can read and write this setting by referring to My.Settings.Counter in code.
 
Thank you so much for your help. I really do appreciate it. I'm going to defintely have to play with this feature, because it is just so awesome. I hope that when I advance from beginner on into intermediate, I still find little things like this so fascinating. Thanks again!!!
 
Back
Top