53346

How to save settings made in VB?

Question:

Is there any way I can save changes made by a user , so that at the next run they would still be there? I have seen something about My.Settings , is that how it is done?

Answer1:

Yes you have multiple options, you can create a file and load it on startup, or you can use the built in settings object. Just go to your Project Property's --> settings set your variable there, the you can access it through My.Settings

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/Q8UOH.png" data-original="https://i.stack.imgur.com/Q8UOH.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Then load it like this:

Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load Dim greeting As String = My.Settings.mySetting End Sub

you would change the value and save it like this

My.Settings.mySetting = "GoodBye" My.Settings.Save()

Recommend

  • Why isn't RAD (Eclipse) able to properly detect WAS server startup?
  • Sharing Redis settings across routes
  • jquery validation - waiting for remote check to complete
  • MeeGo Handset Emulator not starting on Windows 7
  • Does Apportable support to build library binary (.a/.so)?
  • How Get arguments value using inline assembly in C without Glibc?
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • Visual Studio 2010 debugger build correctly - compiler pdb and linker pdb not in synch?
  • How to get Eclipse Oxygen to run on Java 9
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Database structure design with variable amounts of fields
  • Switching to Release Build causes runtime error in Web Reference
  • How do I fake an specific browser client when using Java's Net library?
  • How to get a value (ex: baseURL) in every Karate feature?
  • Weird JavaScript statement, what does it mean?
  • How do you troubleshoot character encoding problems?
  • QuartzCore.framework for Mono Develop
  • Apache 2.4 - remove | delete | uninstall
  • XCode can't find symbols for a specific iOS library/framework project
  • AT Commands to Send SMS not working in Windows 8.1
  • How to format a variable of double type
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Proper folder structure for lots of source files
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Benchmarking RAM performance - UWP and C#
  • How to set the response of a form post action to a iframe source?
  • How do I configure my settings file to work with unit tests?
  • Change div Background jquery
  • Qt: Run a script BEFORE make
  • Is it possible to post an object from jquery to bottle.py?
  • Checking variable from a different class in C#
  • reshape alternating columns in less time and using less memory
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • Net Present Value in Excel for Grouped Recurring CF