If i wanted my program to calculate the period difference between two dates, how can i utilize what's shown below, to write the code? what does this statement mean? Call SaveSetting("Name Of Your Program", "Neopets Login", "Neopets Username", txtUsername.Text) if you're just saving the settings of the username (txtUsername.Text), why would you need the first part, i.e. "Name Of Your Program", "Neopets Login", "Neopets Username", Private Sub Form_Load() chkSave.Value = GetSetting("Name Of Your Program", "Neopets Login", "Save Login Information", Checked) If chkSave.Value = Checked Then txtUsername.Text = GetSetting("Name Of Your Program", "Neopets Login", "Neopets Username") txtPassword.Text = GetSetting("Name Of Your Program", "Neopets Login", "Neopets Password") End If End Sub why do you need the line in red? Why not when the form loads, just check whether the chkSave.Value is checked, and work from there on? thanks.
using "SaveSetting" will create a registery key with the information you provided. That's a good way of saving setting in a program instead of creating an external file that might get lost somewhere. The registery is always at the same place. Now, even if you're only saving the username field, you can specify where you want to save it. Let's say I have 10 programs that all can remember the username. if you simply put username.text, every programs will show the same value. By specifying the program name, you can assign a registery key for each program. So this line "Call SaveSetting("Name Of Your Program", "Neopets Login", "Neopets Username", txtUsername.Text)" will create a key named "Neopets Username", witch will store the content of txtUsername.Text, under the subfolder "Neopets Login", under the folder "Name Of Your Program". You can than use the function "GetSettings" to access this key to get the content of it. Next, the line in red will check if the checkbox chkValue was check the last time the program was closed. If it was checked, it will check it again so the next part of the code will get the content of from "Neopets Username" and "Neopets Password". Since this line is in the Form_Load, it will do so at the opening of the program, thus filling all the needed field at the same time.
thanks alot for the detailed explanation tharoux, will be slowly reading through it, and trying to understand
hmmm alright thanks ^_^ do you have any recommended (video) tutorials that i should follow? cause now i've two sources of tutorials, and might be looking for more (more never hurt right?)
Hmm, that code looks familiar...I thought I saw it in a guide somewhere else http://msdn.microsoft.com/en-us/library/kb0c3wb9(VS.71).aspx This explains it pretty well
Code (Text): Private Sub cmdLogin_Click() cmdLogin.Enabled = False If chkSave.Value = Checked Then Call SaveSetting("Name Of Your Program", "Neopets Login", "Neopets Username", txtUsername.Text) Call SaveSetting("Name Of Your Program", "Neopets Login", "Neopets Password", txtPassword.Text ) Call SaveSetting("Name Of Your Program", "Neopets Login", "Save Login Information", chkSave.Value) Else Call SaveSetting("Name Of Your Program", "Neopets Login", "Save Login Information", chkSave.Value) If box is not checked, what happens? why is there this line present, which is the same as the 3rd line from above. Code (Text): End If cmdLogin.Enabled = True why is the above so strangely located? It’s just below cmdLogin.Enabled = False, how will the program know when to enable login and disable login? Code (Text): End Sub questions are in reference to the line directly above it.