Solved

Help with using application settings in vb.net

Posted on 2012-04-11
7
348 Views
Last Modified: 2012-04-12
Hi,

I hope that someone is able to help. Please find uploaded word document for reference.
I have been reading a tutorial online about accessing application settings.
However when i try to access my variable "debugmodeon":

My.Settings.debugmodeon

I receive the following error - Error      1      
'debugmodeon' is not a member of 'LabourEntryScreen.My.MySettings'.      

I am sure its something simple that i have missed out.

Regards,

Ross
appSettings.docx
0
Comment
Question by:ross13
7 Comments
 
LVL 20

Assisted Solution

by:BuggyCoder
BuggyCoder earned 166 total points
ID: 37832182
Assuming name of your settings file is Settings.settings, use this:-

My.Settings.Default.debugmodeon

Open in new window

0
 
LVL 14

Assisted Solution

by:binaryevo
binaryevo earned 84 total points
ID: 37832197
Looks like your trying to say debugmodeon() which is incorrect it should be

Dim s as String = My.Settings.debugmodeon

Open in new window


This tutorial should be able to help you:

http://www.codeproject.com/Articles/12252/Application-settings-in-VB-NET-2-0-and-Visual-Stud
0
 
LVL 17

Assisted Solution

by:nepaluz
nepaluz earned 83 total points
ID: 37832199
Where is this failing? Is it in the debuger or when you deploy? Also, if after you deploy, how are you deploying the application?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 20

Assisted Solution

by:BuggyCoder
BuggyCoder earned 166 total points
ID: 37832235
i am sorry, you need to use this instead, Just Remove My and simply do this to access your variable:-

Settings.Default.debugmodeon

Open in new window

0
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 84 total points
ID: 37833785
0
 
LVL 7

Assisted Solution

by:vbigham
vbigham earned 83 total points
ID: 37834273

Open in new window

If you locate the Settings.Designer.vb file under the "My Project" folder, you should be able to find the generated property.  If I add one it looks like this:

        <Global.System.Configuration.ApplicationScopedSettingAttribute(), _
         Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
         Global.System.Configuration.DefaultSettingValueAttribute("True")> _
        Public ReadOnly Property IsDebugModeOn() As Boolean
            Get
                Return CType(Me("IsDebugModeOn"), Boolean)
            End Get
        End Property

Open in new window


If it is showing up, but still in error..  I don't know maybe there is some kind of conflict in your project with the My namespace..  

You should still be able to access it by fully qualifying the path to the MySettings default object like this:

        Global.LabourEntryScreen.My.MySettings.Default.IsDebugModeOn

Open in new window

0
 

Author Closing Comment

by:ross13
ID: 37836960
Cheers. That's it working.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now