?
Solved

Application and user settings read value in visual studio

Posted on 2014-09-17
8
Medium Priority
?
146 Views
Last Modified: 2014-11-27
Hi EE,

    I want to change our current way of reading application setting from a text file on disk to have those settings stored in app.config file.
   
   I wrote a class 'TXSettings' which has 100 properties that I'm intending to use to get all the application settings.
 
   I call a 'Load' method upon project startup

 Public Shared Function Load1() As TXSettings

        Dim settings As New TXSettings
        With settings
            .SpeedUnit = My.Settings.SpeedUnit
            .UpgradeRequired = My.Settings.UpgradeRequired
            ......   'The next 98 properties
        End With
        Return settings
    End Function

Open in new window


as you can see the load method will have something like above, is there a cleaner way of doing this? like a loop thru or something else?
0
Comment
Question by:miketonny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 2

Author Comment

by:miketonny
ID: 40329587
hi @Akilandeshwari N,

   how do you do this with an object class? I know System.Reflection and loop through all properties in a class but I don't want to use reflection
0
 
LVL 40
ID: 40329595
Why should you use a custom class to get the settings? My.Settings is already a class that does it for you.
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 2

Author Comment

by:miketonny
ID: 40329625
@JamesBurger,
I haven't tried, but can i bind the datacontext of a window to my.settings?

my planning is to create a 'setting' window for user to view and edit the current setting of the application, with wpf databinding to a class that's real easy.

or is this the correct way of doing this?
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 40329714
I could not say in WPF, my expertise is in Windows Forms Applications. In that environment, yes, you can bind controls to My.Settings just as you can with almost any class in the application.
0
 
LVL 2

Author Comment

by:miketonny
ID: 40329962
thank you for your suggestion
I've found some resources on google showing me  how to bind settings in wpf, gonna try it tomorrow
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

777 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