问题描述
我正在写一个两个项目的应用程序。让我们调用第一个项目ProjectA和第二个项目ProjectB。
ProjectA包含所有应用程序设置,是一个WinForms应用程序。 ProjectB是一个需要读取ProjectA设置的服务。所以这是我遵循的步骤。
1.使ProjectA的设置属性访问修饰符公开而不是内部
2.添加引用到ProjectB中的ProjectA
3.添加一个用于在ProjectB中定义ProjectA的命名空间
4.这样的代码:
bLvl6Rpt = ProjectA.Properties .Settings.Default.Lvl6Report;
我在bLvl6Rpt中得到的是Lvl6Report的默认值,而不是实际设置的值。如何从ProjectA读取实际设置?我知道我可以用XML文件轻松完成这项工作,但是我正在努力学习它是如何工作的。
谢谢,
Glenn
Hi,
I'm writing a two project application. Lets call the first project, ProjectA and the second project ProjectB.
ProjectA contains all the application settings and is a WinForms application. ProjectB is a Service that needs to read ProjectA's settings. So here's the steps I've followed.
1. Make ProjectA's Settings Property Access Modifier Public instead of Internal
2. Add a reference to ProjectA in ProjectB
3. Add a Using to define ProjectA's Namespace in ProjectB
4. Code like this:
bLvl6Rpt = ProjectA.Properties.Settings.Default.Lvl6Report;
What I get in bLvl6Rpt is Lvl6Report's default value, not what is actually set. How do I read the actual settings from ProjectA? I know I can do this easy with an XML file, however I'm trying to learn how this works.
Thank you,
Glenn
推荐答案
这篇关于如何阅读应用程序设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!