Results 1 to 7 of 7

Thread: saving text in textbox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Exclamation 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 ?

  2. #2
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: saving text in textbox

    You can use My.Settings. Just search the forums, there's tons of topics on it.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Re: saving text in textbox

    searched alot and found alot of code but none worked

  4. #4
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: saving text in textbox

    Post the code you used and describe what didn't work.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    Re: saving text in textbox

    doesnt work
    Code:
    My.Settings.remember(TextBox.Text)

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2009
    Posts
    462

    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

  7. #7
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    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.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width