Question String in My.Settings.[name] is being returned as an Integer

vitz3

New member
Joined
May 19, 2012
Messages
1
Programming Experience
Beginner
Hello all!

Just getting started with vb.net and Visual Studio in general. Could someone point me in the right direction please?

So I've got a form with a textbox. In the textbox I'd like to display a setting string from the app.config file and be able to change it's value. Pretty straightforward stuff I was hoping. Nope. In my application settings for the project I've got the setting name, the type, the scope as user and a test value set to "Test String"

Here's a snippet of the code. Very straightforward, but yeah it's giving me 2 instead of Test String
VB.NET:
textbox1.text = My.Settings.Name

I don't have any conversions going on in my code. All I've got so far is a textbox reading that data, but all it gets is 2 at form load. :confusion: When I set a breakpoint there the value is read as 2 as well. This is so far the only area where I need this string. It's not anywhere else in my code yet.

Any help would be great!

Thanks
 
Could you please provide a screen shot of the Settings page of your project properties, the contents of your app.config file and also a screen shot of a break point at that line with your cursor hovering over the Name property to show it's type and value? This is one of those situations where what you say is happening simply shouldn't be possible, so we have to make sure that you are doing what you say you're doing and what you say is happening actually is happening. If it is then something is broken and it's likely very difficult to determine what that is. The first thing to do would be to create a test project with just that setting and see if you get the same behaviour.
 

Latest posts

Back
Top