9 Replies - 1104 Views - Last Post: 10 November 2012 - 11:31 AM Rate Topic: -----

#1 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 10:04 AM

Hey guys, I want to change the value of the textbox, save it, and have that same value show up the next time I load the form. I been struggling with this problem for a long time now. Want I came up with was either write the value to a textfile or table, and when the program start grab the value from the table or file and read it to the textbox.

...But I don't want to do neither one of those. I don't what to save a password to a textfile, and some computer don't have internet connection. So what do I do?

Is This A Good Question/Topic? 0
  • +

Replies To: Keep Value in textfield the same next time form load...

#2 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 10:22 AM

You can also use Settings to do this

Create a user type setting and upon loading of the form set the TextBox's .Text property = My.Settings.{whateveryoucalledyoursetting}

Make sure you update the setting if someone changes the textbox.
Was This Post Helpful? 0
  • +
  • -

#3 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Re: Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 10:34 AM

Can you explain that a little bit more, or is there any place I can get more help from? It's kinda foreign to me.
Was This Post Helpful? 0
  • +
  • -

#4 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 10:40 AM

If you right-click on your Application in the Solution explorer and select properties it will bring up settings specific to your application (ie, Compile options, Resources, etc...) in that window is a tab for Settings.

Create a setting there of type string for User scope and set it's value to what you want to appear in your textbox.

Then upon loading the form you can get that value by using My.Settings.{Setting Name}

Since it is a string in this case, you can set the textbox.text = my.settings.{setting name}
Was This Post Helpful? 0
  • +
  • -

#5 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Re: Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 10:45 AM

Man this is pretty cool. Is it safe and alright to create more of these user type in settings? It really safe me time to read/write from textfile/table.

This post has been edited by clee06: 04 October 2012 - 10:45 AM

Was This Post Helpful? 0
  • +
  • -

#6 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 10:52 AM

Define safe. It's as safe as a textfile if that's what you're asking. But I don't use them a lot so there might be some ramification of speed issues if you have a large amount.

I will say this though, when you create these a .config file is created to hold this information. If you move the executable without its accompanying config file, the textboxes won't be filled. But again, that's probably not really any different than making sure your textfile follows the application.

This post has been edited by CharlieMay: 04 October 2012 - 10:54 AM

Was This Post Helpful? 0
  • +
  • -

#7 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Re: Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 10:57 AM

Haha yes, i meant to say is it safe to store a password in the Settings..

Thank you so much you are a life saver.
Was This Post Helpful? 0
  • +
  • -

#8 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 11:17 AM

Well, I definitely would not store a password in it but I wouldn't in a text file either unless of course you set it with some kind of encryption and some fail safe that handled a situation where a user might open the file and try to set their own.
Was This Post Helpful? 0
  • +
  • -

#9 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Re: Keep Value in textfield the same next time form load...

Posted 04 October 2012 - 12:12 PM

View PostCharlieMay, on 04 October 2012 - 11:17 AM, said:

Well, I definitely would not store a password in it but I wouldn't in a text file either unless of course you set it with some kind of encryption and some fail safe that handled a situation where a user might open the file and try to set their own.


great, i'll save the password to a table?
Was This Post Helpful? 0
  • +
  • -

#10 clee06  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 66
  • Joined: 01-June 10

Re: Keep Value in textfield the same next time form load...

Posted 10 November 2012 - 11:31 AM

I was wondering if I can change the user scope value in the settings?

I created a user scope called "try" with the value of "test".

I want to make a form to change that value. how would I code that syntax? so far my form has a textfield called 'txtTRY' that takes in the value of the 'try' and a button "btnSAVE". When I change the value in txtTRY and click btnSAVE, I want to 'try' new value to be whatever textbox tryTRY' is.


txtTRY.text = My.Settings.try



Was This Post Helpful? 0
  • +
  • -

Page 1 of 1