|
-
Mar 27th, 2009, 08:56 PM
#1
Thread Starter
Hyperactive Member
saving text in textbox
okay say i have a program that has you login to use it is there anyway that i can have it save the text in username and password so when he opens it again it will still be there ?
-
Mar 27th, 2009, 09:09 PM
#2
Re: saving text in textbox
You can use My.Settings. Just search the forums, there's tons of topics on it.
-
Mar 27th, 2009, 09:47 PM
#3
Thread Starter
Hyperactive Member
Re: saving text in textbox
searched alot and found alot of code but none worked
-
Mar 27th, 2009, 09:56 PM
#4
Re: saving text in textbox
Post the code you used and describe what didn't work.
-
Mar 27th, 2009, 10:11 PM
#5
Thread Starter
Hyperactive Member
Re: saving text in textbox
doesnt work
Code:
My.Settings.remember(TextBox.Text)
-
Mar 27th, 2009, 10:30 PM
#6
Thread Starter
Hyperactive Member
Re: saving text in textbox
wait nm i got a goog tut off youtube here is the working code
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
My.Settings.username = TextBox1.Text
My.Settings.Save()
My.Settings.Reload()
My.Settings.password = TextBox2.Text
My.Settings.Save()
My.Settings.Reload()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = My.Settings.Username
TextBox2.Text = My.Settings.Password
End Sub
-
Mar 27th, 2009, 10:47 PM
#7
Re: saving text in textbox
Go to your Application properties and make sure that the check box "Save My.Settings on Close" is checked. Once you check it, you can take all the "My.Settings.Save()" and Reloads out of your code. You only need to store to it and it will automatically save.
Glad it works for you though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|