I am trying to create a self incrementing loop to act as a key field for my project, I have coded a counter, but every time I run the program again, it starts from 1 again, what do I do to ensure that it carries on from the last number written to file? I am a beginner to vb.net. Thank you :)
To achieve this, you can store whatever data you want to store as an application setting.
In visual studio, if you want to add a setting, go to the settings pane of the solution explorer.
Dont forget to call the save function when you are done with updating the value as the values wont get updated unless we call this function.
For more information you can refer to this URL
http://msdn.microsoft.com/en-us/library/bc6ws923.aspx
Alternatively, when the application is exited, you can save the required value to a file and when the program is opened again, you read the file and update the variable to the value stored in the file.