点击Advanced标签旁边省略号按钮打开个对话框该对话框中列出了TextBox所有属性选择Text属性键映射框将会被激活键映射决定了键储存在配置文件中值点击确定关闭对话框
下面代码是在InitializeComponent思路方法中产生(位于Windows Form设计器产生代码区)这段代码不能直接修改只能使用属性窗口
Dim configurationAppSettings As _
.Configuration.AppSettingsReader = _
New .Configuration.AppSettingsReader
Me.TextBox1.Text = CType( _
configurationAppSettings.GetValue("TextBox1.Text", _
GetType(.String)), String)
设置储存在个名为app.cofigXML格式文件中前面举例代码所产生XML代码如下:
<?xml version="1.0" encoding="Windows-1252"?>
<configuration>
<appSettings>
<!-- User application and configured property tings go here.-->
<!-- Example: <add key="tingName" value="tingValue"/> -->
<add key="TextBox1.Text" value="TextBox1" />
</appSettings>
</configuration>
当应用被编译时该文件被重命名为assembly.config这里assembly是你编译出应用名字如果想改变这些值根本没有必要重新编译只要简单编辑配置文件在其中修改成相应值即可
最新评论