将配置文件的信息现在在文本框中。
解决方案 »
- 【初学者求教】如何去掉字符串最前面和最后面的空格
- datagridview的单元格编辑问题,在线等,解决就结贴
- Winform 程序 mdichild最大化后,希望mdichild的标题栏不显示
- vs2005中有不有像excel中的计算函数的库了,比如求平均值,求和这些的,都要编程实现,有些实在是太花时间了,希望指教。
- 怎么停止进程?
- timer1_Tick(..)如何调用Mybutton_Paint(..)事件呢?
- 请求赐教:初学C#的两个问题
- c#调用excel问题!
- 在线等待:我已经在form_load里建立了控件数组,如何在其他事件中读出控件属性
- C#构造josn格式
- C# Cpu 使用不端增加的问题
- C#初学者小问题之十一——关于音乐播放器的问题
根据XML的 思想去读
public class IniFile
{
public string path; [DllImport("kernel32 ")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32 ")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); /// <summary>
/// INIFile Constructor.
/// </summary>
/// <PARAM name= "INIPath "> </PARAM>
public IniFile(string INIPath)
{
path = INIPath;
}
/// <summary>
/// Write Data to the INI File
/// </summary>
/// <PARAM name= "Section "> </PARAM>
/// Section name
/// <PARAM name= "Key "> </PARAM>
/// Key Name
/// <PARAM name= "Value "> </PARAM>
/// Value Name
//public void IniWriteValue(string Section, string Key, string Value)
//{
// WritePrivateProfileString(Section, Key, Value, this.path);
//} /// <summary>
/// Read Data Value From the Ini File
/// </summary>
/// <PARAM name= "Section "> </PARAM>
/// <PARAM name= "Key "> </PARAM>
/// <PARAM name= "Path "> </PARAM>
/// <returns> </returns>
public string IniReadValue(string Section, string Key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, " ", temp, 255, this.path);
return temp.ToString(); }
}这是读INI格式的,其他的可以搜一下 呵呵
ini GetPrivateProfileString
config通过xml,System.Web.Configuration.WebConfigurationManager