Shubham
Shubham

Reputation: 22315

Settings variable returning a different value in VB.net!

This is a quite strange problem. I have set a setting variable in Application settings with following data:

Yet when I reference it with this statement: MsgBox(My.MySettings.Default.county) It alerts 1. Despite being the first to be executed as soon as form loads.

Upvotes: 1

Views: 851

Answers (1)

Hans Olsson
Hans Olsson

Reputation: 55009

I'm assuming that the My.MySettings bit is a typo.

Often when someone sees a different value than they expect when reading from My.Settings, it seems to be that they are reading the Default rather than the actual value.
I'd suggest trying to use just MsgBox(My.MySettings.county) and see if that returns what you want.

Otherwise, try to delete the bin and object directories of the project and try to re-compile and re-run and see if it might be something that had gotten "stuck" somewhere.

Upvotes: 1

Related Questions