1、在头部引用
- [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);
2、写入.ini
- WritePrivateProfileString("Setup","UserName",userno.Text,Application.StartupPath+"\\mcs.ini");
3、读取.ini
- StringBuilder temp = new StringBuilder(255);
- int i = GetPrivateProfileString("Setup","UserName","",temp,255, Application.StartupPath+"\\mcs.ini");
- userno.Text = temp.ToString();
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索string
, application
, ini
, stringbuilder
, username
dllimport
winform 读写ini、winform 读写文件、winform 读写配置文件、winform ini文件、c ini文件读写,以便于您获取更多的相关知识。
时间: 2024-10-09 03:12:51