Saving information when program is exited

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cmdolcet69

    #1

    Saving information when program is exited

    Does anyone know how i could save a user textbox entery value and then
    when the program is shut down it would save that value for the next
    time so that it appears when the user start the program back up

    Example:

    user enters his name:Chuck

    I want to be able to save the entery (chuck) so that when he exits the
    program (shut down) and then start it back up again the user entry
    name in the textbox would be chuck.

  • cj

    #2
    Re: Saving information when program is exited

    Put the code to save the info in the Form1_FormClosi ng event.

    cmdolcet69 wrote:
    Does anyone know how i could save a user textbox entery value and then
    when the program is shut down it would save that value for the next
    time so that it appears when the user start the program back up
    >
    Example:
    >
    user enters his name:Chuck
    >
    I want to be able to save the entery (chuck) so that when he exits the
    program (shut down) and then start it back up again the user entry
    name in the textbox would be chuck.
    >

    Comment

    • zacks@construction-imaging.com

      #3
      Re: Saving information when program is exited

      On Sep 6, 2:57 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
      Does anyone know how i could save a user textbox entery value and then
      when the program is shut down it would save that value for the next
      time so that it appears when the user start the program back up
      >
      Example:
      >
      user enters his name:Chuck
      >
      I want to be able to save the entery (chuck) so that when he exits the
      program (shut down) and then start it back up again the user entry
      name in the textbox would be chuck.
      Simplest way to do that is with My.Settings.

      Comment

      • cmdolcet69

        #4
        Re: Saving information when program is exited

        On Sep 6, 3:46 pm, za...@construct ion-imaging.com wrote:
        On Sep 6, 2:57 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
        >
        Does anyone know how i could save a user textbox entery value and then
        when the program is shut down it would save that value for the next
        time so that it appears when the user start the program back up
        >
        Example:
        >
        user enters his name:Chuck
        >
        I want to be able to save the entery (chuck) so that when he exits the
        program (shut down) and then start it back up again the user entry
        name in the textbox would be chuck.
        >
        Simplest way to do that is with My.Settings.
        Does vb.net 2003 have a my.settings ???

        Comment

        • zacks@construction-imaging.com

          #5
          Re: Saving information when program is exited

          On Sep 6, 4:07 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
          On Sep 6, 3:46 pm, za...@construct ion-imaging.com wrote:
          >
          On Sep 6, 2:57 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
          >
          Does anyone know how i could save a user textbox entery value and then
          when the program is shut down it would save that value for the next
          time so that it appears when the user start the program back up
          >
          Example:
          >
          user enters his name:Chuck
          >
          I want to be able to save the entery (chuck) so that when he exits the
          program (shut down) and then start it back up again the user entry
          name in the textbox would be chuck.
          >
          Simplest way to do that is with My.Settings.
          >
          Does vb.net 2003 have a my.settings ???
          Looks like it is. But with VS2003, this link may prove useful:

          http://msdn2.microsoft.com/en-us/lib...11(VS.80).aspx

          Comment

          • Phillip Taylor

            #6
            Re: Saving information when program is exited

            On 6 Sep, 21:55, za...@construct ion-imaging.com wrote:
            On Sep 6, 4:07 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
            >
            >
            >
            On Sep 6, 3:46 pm, za...@construct ion-imaging.com wrote:
            >
            On Sep 6, 2:57 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
            >
            Does anyone know how i could save a user textbox entery value and then
            when the program is shut down it would save that value for the next
            time so that it appears when the user start the program back up
            >
            Example:
            >
            user enters his name:Chuck
            >
            I want to be able to save the entery (chuck) so that when he exits the
            program (shut down) and then start it back up again the user entry
            name in the textbox would be chuck.
            >
            Simplest way to do that is with My.Settings.
            >
            Does vb.net 2003 have a my.settings ???
            >
            Looks like it is. But with VS2003, this link may prove useful:
            >
            http://msdn2.microsoft.com/en-us/lib...11(VS.80).aspx
            Go to project properties, and then Settings and add a entry called
            "name" make it a type of string and make the default value blank.

            Then in your app set the default value under the form_load procedure
            like this:

            txtName.Text = My.Settings.Nam e

            When the program closes, under your form_closed procedure, save it
            like this:

            My.Settings.Nam e = txtName.Text
            My.Settings.Sav e()

            --

            That's all you need.

            Good luck :-)

            Phill

            Comment

            • cmdolcet69

              #7
              Re: Saving information when program is exited

              On Sep 7, 6:17 am, Phillip Taylor <Phillip.Ross.T ay...@gmail.com >
              wrote:
              On 6 Sep, 21:55, za...@construct ion-imaging.com wrote:
              >
              >
              >
              >
              >
              On Sep 6, 4:07 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
              >
              On Sep 6, 3:46 pm, za...@construct ion-imaging.com wrote:
              >
              On Sep 6, 2:57 pm, cmdolcet69 <colin_dolce... @hotmail.comwro te:
              >
              Does anyone know how i could save a user textbox entery value and then
              when the program is shut down it would save that value for the next
              time so that it appears when the user start the program back up
              >
              Example:
              >
              user enters his name:Chuck
              >
              I want to be able to save the entery (chuck) so that when he exits the
              program (shut down) and then start it back up again the user entry
              name in the textbox would be chuck.
              >
              Simplest way to do that is with My.Settings.
              >
              Does vb.net 2003 have a my.settings ???
              >
              Looks like it is. But with VS2003, this link may prove useful:
              >>
              Go to project properties, and then Settings and add a entry called
              "name" make it a type of string and make the default value blank.
              >
              Then in your app set the default value under the form_load procedure
              like this:
              >
              txtName.Text = My.Settings.Nam e
              >
              When the program closes, under your form_closed procedure, save it
              like this:
              >
              My.Settings.Nam e = txtName.Text
              My.Settings.Sav e()
              >
              --
              >
              That's all you need.
              >
              Good luck :-)
              >
              Phill- Hide quoted text -
              >
              - Show quoted text -
              Phil can you be a little more specific, in the programing environment
              vb 2003 i can;t seem to find that option. Please let me know....Thanks

              Comment

              • Andrew Morton

                #8
                Re: Saving information when program is exited

                cmdolcet69 wrote:
                Phil can you be a little more specific, in the programing environment
                vb 2003 i can;t seem to find that option. Please let me know....Thanks
                The My.Settings thing isn't in vb 2003. You'll have to write your own
                procedure to write the data to a file or into the registry, and similarly to
                read the data back in when the app. starts.

                Andrew


                Comment

                Working...