Results 1 to 8 of 8

Thread: [RESOLVED] Remembering Text.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2010
    Posts
    95

    Resolved [RESOLVED] Remembering Text.

    So I want to create a small notepad, that on closure, saves whatever is in the noetpad without a prompt, and when opened, displays in the notepad what was in it before it closed.

    Can anyone help me with this? The notepad is just a simple TextBox.

    Thanks in Advance guys .

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Remembering Text.

    you could use (ApplicationSettings):

    1/ select your textbox in your design time form
    2/ expand (ApplicationSettings) in your properties window
    3/ select (PropertyBindings) + click the ellipsis to the right
    4/ select the text property in the dialog + click the dropdown arrow to the right
    5/ click New in the dropdown menu + type in a name for the property in the New Application Setting window
    6/ click OK on the New Application Setting window
    7/ click OK on the Application Settings window

  3. #3
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: Remembering Text.

    may be you can use Settings like this:
    Code:
     Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            My.Settings("Notepad") = TextBox1.Text
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            TextBox1.Text = My.Settings("Notepad")
    
        End Sub
    __________________
    Rate the posts that helped you

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: Remembering Text.

    Quote Originally Posted by riteshjain1982 View Post
    may be you can use Settings like this:
    Code:
     Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            My.Settings("Notepad") = TextBox1.Text
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            TextBox1.Text = My.Settings("Notepad")
    
        End Sub
    @riteshjain1982 - you forgot to mention that you need to add a my.settings string setting named Notepad to use that method

  5. #5
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: Remembering Text.

    Quote Originally Posted by .paul. View Post
    @riteshjain1982 - you forgot to mention that you need to add a my.settings string setting named Notepad to use that method
    thanks for correction
    __________________
    Rate the posts that helped you

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jun 2010
    Posts
    95

    Re: Remembering Text.

    It's all working.
    Thanks for the help Paul.

  7. #7
    Lively Member swingyswongy's Avatar
    Join Date
    Jun 2010
    Location
    Bay area, CA
    Posts
    83

    Re: Remembering Text.

    Quote Originally Posted by .paul. View Post
    @riteshjain1982 - you forgot to mention that you need to add a my.settings string setting named Notepad to use that method
    how do you do that?

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: [RESOLVED] Remembering Text.

    Project-->Properties-->Settings, + you can probably work it out from there...

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