Friday, July 31, 2009

Save button in a visual basic 6 program?

Ok, im on making a program in visual basic 6, I want an option so that a user can save/load their progress.





It needs to save everthing on the form as there is a password field that a user can change and that needs to stay changed when the program is closed.





And aldo several text fields that need to stay changed with anything a user has entered into them.

Save button in a visual basic 6 program?
You may make use of registry. The simplest way to do this in VB is the SaveSetting ang GetSetting function... For example, you might want to save the text enterd in TextBox1.. Here's how you do it...





on the Form_Unload() procedure...








SaveSetting App.Name, "TextBox", "Text", TextBox1.Text








Now, whatever text that has been entered in TextBox1 will be saved in the VB Registry. Note that TextBox1 is the name of the textbox being in use..


To load this setting as the program re-runs. Do this...





on the Form_Load() procedure...








TextBox1.Text = GetSetting(App.Name, "TextBox", "Text")








The text that was saved before previous program end will be loaded and automatically printed on TextBox1. (^^,) If you want to learn more about this function, feel free to ask me at YM rdb_dvo16 or just post a comment on any of my articles on my blog http://ronaldborla.blogsome.com/ Ok? (^^,)
Reply:You will find the answer here





http://www.freetutes.com/VisualBasic


No comments:

Post a Comment