You can do this many ways.
I will show you how to do it using the registry and a simple text file.
1) I assume you have a control on your form that is supposed to save the data when it is clicked, double clicked or whatever.
2) The "save" code will go in the appropriate event (click/double click/mouse over/whatever), the "load" code will go in either the form load event or the "Sub Main" of your startup object. According to your description you want the data to "auto load" when the application is started.
SAVE CODE Example 1:
SaveSetting applicationname, "Settings", "Last Name", txtLastName.Text
SaveSetting applicationname, "Settings", "First Name", txtFirstName.Text
SaveSetting applicationname, "Settings", "Address", txtAddress.Text
SaveSetting applicationname, "Settings", "City", txtCity.Text
SaveSetting applicationname, "Settings", "State", txtState.Text
SaveSetting applicationname, "Settings", "Zip", txtZip.Text
applicationname is the name of your application (duh)
"Settings" is a literal that can be anything meaningful that you want...such as;"Form1 Settings", "Address Settings", etc
The next parameter ("First Name","Last Name", etc.) is a meaningful name for each "thing" you want to save.
The last parameter is the actual data that you are wanting to save.
SAVE CODE Example 2:
dim intFileNum as integer
intFileNum = FreeFile
Open "Settings.txt" for output as #intFileNum
print #intfilenum, txtLastName.Text
print #intfilenum, txtFirstName.Text
print #intfilenum, txtAddress.Text
print #intfilenum, txtCity.Text
print #intfilenum, txtState.Text
print #intfilenum, txtZip.Text
Close #intFileNum
The above code open a text file on your default drive and in a default location, generally where you have saved your application.
It then writes data to this file one line at a time, no identifiers or anything, just data followed by carriage return and line feed (vbCRLF).
The last line flushes the write buffer and closes the file.
READ CODE Example 1:
txtLastName.Text = GetSetting(applicationname, "Settings", "Last Name", "")
txtFirstName.Text = GetSetting(applicationname, "Settings", "First Name", "")
txtAddress.Text = GetSetting(applicationname, "Settings", "Address", "")
txtCity.Text = GetSetting(applicationname, "Settings", "City", "")
txtState.Text = GetSetting(applicationname, "Settings", "State", "")
txtZip.Text = GetSetting(applicationname, "Settings", "Zip", "")
This is just the reverse of the SaveSetting, however, the last parameter ("") is a default is the setting cannot be found in the registry.
READ CODE Example 2:
dim intFileNum as integer
intFileNum = FreeFile
Open "Settings.txt" for input as #intFileNum
input #intfilenum, txtLastName.Text
input #intfilenum, txtFirstName.Text
input #intfilenum, txtAddress.Text
input #intfilenum, txtCity.Text
input #intfilenum, txtState.Text
input #intfilenum, txtZip.Text
Close #intFileNum
2006-11-03 06:26:04
·
answer #1
·
answered by timc_fla 5
·
0⤊
0⤋
This is the dumbest question I have seen on Yahoo!
You have to simply save them into Database and its such a simple part of a software development life cycle!!!
But since u asked, I hope its more complicated than you have explained. Add a comment of how big of a thing is your problem. If its just showing some start up fields, then we do it daily basis in Web Development.
Good Luck!
2006-11-03 06:01:42
·
answer #3
·
answered by KS 3
·
0⤊
1⤋