写入配置文件 [英] writing into config file

查看:82
本文介绍了写入配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Windows窗体应用程序中的c#代码将值写入app配置文件

解决方案

展开 | 选择 | Wrap | 行号

hi

刚才我有代码

config.AppSettings.Settings [" newVal"]。Value =" 100" ;
用于写入app.config文件的


但它显示的错误是

"对象引用未设置为对象的实例。

你可以澄清我的疑问吗?


"对象引用未设置为对象的实例。表示您指的是没有值的对象。它可以通过将对象声明为New来解决。你能发布给你错误的代码吗?


史蒂文


how to write values into app config files using c# code in windows forms applications

解决方案

Expand|Select|Wrap|Line Numbers


hi
just now i have the the code
config.AppSettings.Settings["newVal"].Value = "100";
for writing into app.config file
but the error it is showing is
"Object reference not set to an instance of an object."
can u please clarify my doubt?


"Object reference not set to an instance of an object." means that you are referring to an object without a value. It can be solved by declaring the object as New. Can you post the code that gives you the error?

Steven


这篇关于写入配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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