changing the value of a user setting

ethicalhacker

Well-known member
Joined
Apr 22, 2007
Messages
142
Location
Delhi,India
Programming Experience
5-10
I created a new user setting of string type called Homepage
I created the following procedure
VB.NET:
Sub ChangeNickname(ByVal newNickname As String)
    My.Settings.Nickname = newNickname
End Sub
and called this procedure on click of a button like ChangeNickname(textbox1.text)
there is no error but there is no chnge in the user setting Homepage either
What have I left out?
 
Hi there,

This works for me:

VB.NET:
Dim newnickname As String = "Marge"
My.Settings.Item("Nickname") = newnickname
Me.TextBox1.Text = My.Settings.nickname.ToString

Hope this helps.

Alex
 
In application properties there options for "Enable application framework" and "Save My.Settings on Shutdown", both enabled by default. Have you by chance unselected one of these?
 
There is no difference between My.Settings.Item("Nickname") and My.Settings.nickname.
 
i know but the problem was that when i go to the application properties the newly set values arent shown but it working fine at runtime. why is this it used to show the newly set values in appliccation properties in setting before now I dont know why its not showing
And also options for "Enable application framework" and "Save My.Settings on Shutdown", are both enabled
 
I see. The values of setting in application properties are the ones used when deploying the application, ie the initial values (first time use). When you start the app in debugging a configuration file is created, same as if the app was installed to a different computer with setup. So if you change value in runtime during debugging only the configuration file for current user is changed, not the initial values in project settings, these will deploy same to anyone installing the app. If you want to change the default settings values you have to do so in application settings, not during runtime.
 
Back
Top