凡被保存在VB .NET 2010 My.Settings? [英] Where are My.Settings saved in VB 2010 .NET?

查看:702
本文介绍了凡被保存在VB .NET 2010 My.Settings?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

My.Settings 保存在程序本身的价值或他们得到存储在注册表中?因此,举例来说,如果我设置了 My.Settings 值与计划,那么我的程序本身复制到另一台电脑 - 是我的。设置值仍然设置?

解决方案

这取决于的范围您选择。有两个范围的设置 - 应用程序和用户范围

从MSDN文章:

  

应用程序范围的设置是只读的,并且所有的共享   用户的应用程序。这些设置存储在App.config   文件中的部分。在运行时,在app.config   文件将在您的bin文件夹,将被命名为您   应用程序的名称(MySettingsDemo.exe.config)。

     

用户范围设置特定于每个用户。它们可以读取和   应用程序code运行时安全设置。这些设置   存储在user.config文件。技术上准确,有   每个用户提供两种user.configs每个应用程序,一个用于非漫游和一个   漫游。虽然Visual Basic 2005中的文件指出,   该user.config文件将根据用户的名称被命名为   (joe.config),这不是这种情况。该user.config文件中创建   的:

  c为C:\ Documents和Settings>\<username>\[LocalSettings\]ApplicationData\<companyname>\<appdomainname>_<eid>_<hash>\<verison>.
 

Are My.Settings values saved in the program itself or do they get stored in the registry? So, for example, if I set a My.Settings value with a program, then I copy the program itself to another PC - is the My.Settings value still set?

解决方案

It depends upon the scope you have selected. There are two scope settings - Application and User scope.

From MSDN article:

Application-scoped settings are read-only and are shared between all users of that application. These settings are stored in the app.config file in the section. At run time, the app.config file will be in your bin folder and will be named with your application's name (MySettingsDemo.exe.config).

User-scope settings are specific for each user. They can be read and set safely by the application code at run time. These settings are stored in a user.config file. To be technically accurate, there are two user.configs per user per application—one for non-roaming and one for roaming. Although the Visual Basic 2005 documentation states that the user.config file will be named according to the user's name (joe.config), this is not the case. The user.config file is created in the:

<c:\Documents and Settings>\<username>\[LocalSettings\]ApplicationData\<companyname>\<appdomainname>_<eid>_<hash>\<verison>.

这篇关于凡被保存在VB .NET 2010 My.Settings?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆