Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. About User Entered Data [modified]

About User Entered Data [modified]

Scheduled Pinned Locked Moved Visual Basic
questioncsharphelp
6 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BrazenSix
    wrote on last edited by
    #1

    Hey all, Newbie question here that probably has a simple solution that I can't seem to find, but I'm new to programming and am still playing around. ;) What I'm trying to do, is create a program that will allow someone to enter data into a couple textboxes. What I want to happen is, to have a button that allows the user to "save" his/her entered data in these textboxes so that when they launch the program again, these changes are displayed until they are changed again. Can anyone give me some sample code that would accomplish this? Any help or links to appropriate articles would be greatly appreciated. Thanks! Oh, forgot to mention that I'm using VB.Net 2003. -- modified at 12:33 Wednesday 26th July, 2006

    A N 2 Replies Last reply
    0
    • B BrazenSix

      Hey all, Newbie question here that probably has a simple solution that I can't seem to find, but I'm new to programming and am still playing around. ;) What I'm trying to do, is create a program that will allow someone to enter data into a couple textboxes. What I want to happen is, to have a button that allows the user to "save" his/her entered data in these textboxes so that when they launch the program again, these changes are displayed until they are changed again. Can anyone give me some sample code that would accomplish this? Any help or links to appropriate articles would be greatly appreciated. Thanks! Oh, forgot to mention that I'm using VB.Net 2003. -- modified at 12:33 Wednesday 26th July, 2006

      A Offline
      A Offline
      Aaron128
      wrote on last edited by
      #2

      Hi, you can do this using the registry. Well thats what I did. To save the settings to the registry you need this code My.Computer.Registry.CurrentUser.CreateSubKey("_name of your program_") My.Computer.Registry.SetValue_("HKEY_CURRENT_USER\_name of your_ _program_","_textbox name_", _textbox name_.Text) To load the data back into the textbox you can use this. _textbox name_.Text = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\_program name_", "_textbox name_", Nothing) You need to put this code in a button or a timer and something like that. Good luck:laugh: -- modified at 13:23 Wednesday 26th July, 2006

      B 2 Replies Last reply
      0
      • A Aaron128

        Hi, you can do this using the registry. Well thats what I did. To save the settings to the registry you need this code My.Computer.Registry.CurrentUser.CreateSubKey("_name of your program_") My.Computer.Registry.SetValue_("HKEY_CURRENT_USER\_name of your_ _program_","_textbox name_", _textbox name_.Text) To load the data back into the textbox you can use this. _textbox name_.Text = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\_program name_", "_textbox name_", Nothing) You need to put this code in a button or a timer and something like that. Good luck:laugh: -- modified at 13:23 Wednesday 26th July, 2006

        B Offline
        B Offline
        BrazenSix
        wrote on last edited by
        #3

        I'll give that a try. Thanks!

        1 Reply Last reply
        0
        • A Aaron128

          Hi, you can do this using the registry. Well thats what I did. To save the settings to the registry you need this code My.Computer.Registry.CurrentUser.CreateSubKey("_name of your program_") My.Computer.Registry.SetValue_("HKEY_CURRENT_USER\_name of your_ _program_","_textbox name_", _textbox name_.Text) To load the data back into the textbox you can use this. _textbox name_.Text = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\_program name_", "_textbox name_", Nothing) You need to put this code in a button or a timer and something like that. Good luck:laugh: -- modified at 13:23 Wednesday 26th July, 2006

          B Offline
          B Offline
          BrazenSix
          wrote on last edited by
          #4

          Just wanted to thank you again for the help. I got it to work properly, although using a slightly 'different' wording, i suppose. Your code was giving me some errors, so I looked for a couple of different ways of doing the same thing and this one ended up working for me. My code ended up looking like this: Dim CompSN_Reg As Microsoft.Win32.RegistryKey CompSN_Reg = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("ACQ01") CompSN_Reg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("ACQ01", True) CompSN_Reg = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("ACQ01\\CompSN") CompSN_Reg.SetValue(txt_ACQ01_Comp_SN.Text, txt_ACQ01_Comp_SN.Text) Same idea in theory... but so fickle. Ahhh, I'm constantly reminded why I've always hated programming. :laugh: Anyways, Thanks! :)

          A 1 Reply Last reply
          0
          • B BrazenSix

            Just wanted to thank you again for the help. I got it to work properly, although using a slightly 'different' wording, i suppose. Your code was giving me some errors, so I looked for a couple of different ways of doing the same thing and this one ended up working for me. My code ended up looking like this: Dim CompSN_Reg As Microsoft.Win32.RegistryKey CompSN_Reg = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("ACQ01") CompSN_Reg = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("ACQ01", True) CompSN_Reg = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("ACQ01\\CompSN") CompSN_Reg.SetValue(txt_ACQ01_Comp_SN.Text, txt_ACQ01_Comp_SN.Text) Same idea in theory... but so fickle. Ahhh, I'm constantly reminded why I've always hated programming. :laugh: Anyways, Thanks! :)

            A Offline
            A Offline
            Aaron128
            wrote on last edited by
            #5

            Oh well, I don't mind. I'm quite new to VB.NET :| Aaron It might be because I use VB.NET 2005 -- modified at 17:44 Wednesday 26th July, 2006

            1 Reply Last reply
            0
            • B BrazenSix

              Hey all, Newbie question here that probably has a simple solution that I can't seem to find, but I'm new to programming and am still playing around. ;) What I'm trying to do, is create a program that will allow someone to enter data into a couple textboxes. What I want to happen is, to have a button that allows the user to "save" his/her entered data in these textboxes so that when they launch the program again, these changes are displayed until they are changed again. Can anyone give me some sample code that would accomplish this? Any help or links to appropriate articles would be greatly appreciated. Thanks! Oh, forgot to mention that I'm using VB.Net 2003. -- modified at 12:33 Wednesday 26th July, 2006

              N Offline
              N Offline
              Nouvand
              wrote on last edited by
              #6

              Beside using the registry, you can use My.Settings to store your setting. You have to create your setting in Design Time You can set this in Project Properties and point to Settings Tab. The settings will be save into XML format in your application path here's the code to change and save the settings ---------------------------------------- My.Settings.UserName = "BrazenSix" My.Settings.Subject = "About what??" My.Settings.Save() to retrieve settings value ---------------------------------------- Dim UName, USubject As String UName = My.Settings.UserName USubject = My.Settings.Subject

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups