S
Shadow42
Guest
So I'm working on a project that will control the blinds in my house, it should be a fairly simple application, but I've run into a snag with the My.Settings.
Under the settings tab of my project, I defined 3 strings for my timers. 3 Strings called OpenTime, CloseTime, and RefrshTime. They are defined as "6:00 AM", "6:00 PM", "4:00 AM" (respectively) in the settings tab of the project properties. When I run my application in debug, in my Form1 load routine I have these lines:
Try
refreshTime = DateTime.Parse(My.Settings.RefreshTime)
closeTime = DateTime.Parse(My.Settings.CloseTime)
openTime = DateTime.Parse(My.Settings.OpenTime)
Catch ex As Exception
stsBar.Text = "Failed to parse set times from Settings."
End Try
If I throw a break point on any of these lines, and get the value of My.Settings.RefresTime,My.Settings.CloseTime, or My.Settings.OpenTime it is "2:00 AM" (they are all the same incorrect value). If I then change the values, and save my settings, it does update the user.config file like so:
<setting name="OpenTime" serializeAs="String">
<value>7:00 AM</value>
</setting>
<setting name="CloseTime" serializeAs="String">
<value>9:00 AM</value>
</setting>
<setting name="RefreshTime" serializeAs="String">
<value>8:00 AM</value>
</setting>
However, when I close my application and restart it, it loads "2:00 AM" into all the strings again.
These vales are not in the user.config file, they are not the default values in the application.exe.config file. If I run the program outside of the debugger, the same issue occurs. All other settings work properly, it is only these 3 Strings that are causing problems. I will also note that the "RefreshTime" setting WAS set to "2:00 AM" at one time, but the other Strings were never set to "2:00 AM". Any thoughts on where else it may be getting these rogue strings from?
-Thanks
Continue reading...
Under the settings tab of my project, I defined 3 strings for my timers. 3 Strings called OpenTime, CloseTime, and RefrshTime. They are defined as "6:00 AM", "6:00 PM", "4:00 AM" (respectively) in the settings tab of the project properties. When I run my application in debug, in my Form1 load routine I have these lines:
Try
refreshTime = DateTime.Parse(My.Settings.RefreshTime)
closeTime = DateTime.Parse(My.Settings.CloseTime)
openTime = DateTime.Parse(My.Settings.OpenTime)
Catch ex As Exception
stsBar.Text = "Failed to parse set times from Settings."
End Try
If I throw a break point on any of these lines, and get the value of My.Settings.RefresTime,My.Settings.CloseTime, or My.Settings.OpenTime it is "2:00 AM" (they are all the same incorrect value). If I then change the values, and save my settings, it does update the user.config file like so:
<setting name="OpenTime" serializeAs="String">
<value>7:00 AM</value>
</setting>
<setting name="CloseTime" serializeAs="String">
<value>9:00 AM</value>
</setting>
<setting name="RefreshTime" serializeAs="String">
<value>8:00 AM</value>
</setting>
However, when I close my application and restart it, it loads "2:00 AM" into all the strings again.
These vales are not in the user.config file, they are not the default values in the application.exe.config file. If I run the program outside of the debugger, the same issue occurs. All other settings work properly, it is only these 3 Strings that are causing problems. I will also note that the "RefreshTime" setting WAS set to "2:00 AM" at one time, but the other Strings were never set to "2:00 AM". Any thoughts on where else it may be getting these rogue strings from?
-Thanks
Continue reading...