Geeks With Blogs

News


Rodney Vinyard - .NET & SQL Developer When all is said and done, more will be said than done

Imports System.Configuration

 

Public Class Form1

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)

        Me.txtFromFolder.Text = ConfigurationManager.AppSettings("fromFolder")

        Me.txtToFolder.Text = ConfigurationManager.AppSettings("toFolder")

 

 

    End Sub

 

    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing

 

 

        'to write

        Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)

 

        config.AppSettings.Settings.Remove("fromFolder")

        config.AppSettings.Settings.Add("fromFolder", txtFromFolder.Text.Trim)

 

        config.AppSettings.Settings.Remove("toFolder")

        config.AppSettings.Settings.Add("toFolder", txtToFolder.Text.Trim)

 

        config.Save(ConfigurationSaveMode.Modified)

 

        ConfigurationManager.RefreshSection("appSettings")

 

    End Sub

Posted on Thursday, April 29, 2010 6:42 PM configuration | Back to top


Comments on this post: Read & Write app.config

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Rodney Vinyard | Powered by: GeeksWithBlogs.net