H
han.c.h
Guest
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;
using System.IO;
namespace EXPORT
{
public partial class Form1 : DevExpress.XtraEditors.XtraForm
{
[DllImport('kernel32')]
public static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport('kernel32')]
public static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
public Form1()
{
InitializeComponent();
dataGridView1.AllowUserToAddRows = true; //자동 행 추가
dataGridView1.AutoGenerateColumns = false;
}
private void button1_Click(object sender, EventArgs e)
{
for (int j = 0; j < dataGridView1.RowCount - 1; j++)
{
if (j < = 2)
{
WritePrivateProfileString(dataGridView1[0, 0].Value.ToString(), dataGridView1[1, j].Value.ToString(), dataGridView1[2, j].Value.ToString(), @'D:\MCSC_Agent.ini');
}
if(j >= 3)
{
WritePrivateProfileString(dataGridView1[0, 4].Value.ToString(), dataGridView1[1, j].Value.ToString(), dataGridView1[2, j].Value.ToString(), @'D:\MCSC_Agent.ini');
}
}
MessageBox.Show('EXPORT successfully to *.INI format');
}
private void button2_Click(object sender, EventArgs e) //ADD_ROW Button
{
DataGridViewButtonColumn button = new DataGridViewButtonColumn();
{
dataGridView1.Rows.Add();
}
}
//private void WriteInFile(string section, string key, string value, string path)
//{
// WritePrivateProfileString(section, key, value, path);
// if (value == null)
// {
// throw new ArgumentException();
// }
//}
If the section data is null, I would like the key value to be inserted based on the next section data if it has a section value entered above it, and if there is a section value,
now ...section key value 3data/section2 key data 3data.
<section>
1 =2
3=4
5=6
<section2>
7=8
9=10
11=12
->
as -to
<section>
1 =2
3=4
5=6
44=18
45=19
<section2>
7=8
9=10
11=12
Continue reading...
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;
using System.IO;
namespace EXPORT
{
public partial class Form1 : DevExpress.XtraEditors.XtraForm
{
[DllImport('kernel32')]
public static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport('kernel32')]
public static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
public Form1()
{
InitializeComponent();
dataGridView1.AllowUserToAddRows = true; //자동 행 추가
dataGridView1.AutoGenerateColumns = false;
}
private void button1_Click(object sender, EventArgs e)
{
for (int j = 0; j < dataGridView1.RowCount - 1; j++)
{
if (j < = 2)
{
WritePrivateProfileString(dataGridView1[0, 0].Value.ToString(), dataGridView1[1, j].Value.ToString(), dataGridView1[2, j].Value.ToString(), @'D:\MCSC_Agent.ini');
}
if(j >= 3)
{
WritePrivateProfileString(dataGridView1[0, 4].Value.ToString(), dataGridView1[1, j].Value.ToString(), dataGridView1[2, j].Value.ToString(), @'D:\MCSC_Agent.ini');
}
}
MessageBox.Show('EXPORT successfully to *.INI format');
}
private void button2_Click(object sender, EventArgs e) //ADD_ROW Button
{
DataGridViewButtonColumn button = new DataGridViewButtonColumn();
{
dataGridView1.Rows.Add();
}
}
//private void WriteInFile(string section, string key, string value, string path)
//{
// WritePrivateProfileString(section, key, value, path);
// if (value == null)
// {
// throw new ArgumentException();
// }
//}
If the section data is null, I would like the key value to be inserted based on the next section data if it has a section value entered above it, and if there is a section value,
now ...section key value 3data/section2 key data 3data.
<section>
1 =2
3=4
5=6
<section2>
7=8
9=10
11=12
->
as -to
<section>
1 =2
3=4
5=6
44=18
45=19
<section2>
7=8
9=10
11=12
Continue reading...