C#操作操作INI配置文件示例详解配置文件示例详解
本文实例为大家分享了C#操作INI配置文件示例的具体代码,供大家参考,具体内容如下
源文件地址:C#操作INI配置文件示例
创建如图所示的控件:
源代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("kernel32.dll")]
private static extern long WritePrivateProfileString(string section, string key, string value, string filepath);
[DllImport("kernel32.dll")]
private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder
returnvalue,intbuffersize,string filepath);
private string IniFilePath;
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.Text = "男";
for (int i = 1; i <= 100; i++)
{
comboBox2.Items.Add(i.ToString());
评论0