H
han.c.h
Guest
ini파일을 datagridview에 올리고 띄우고 싶은데요 - HOONS닷넷
When I enter the URL above,
One thing ... if I have the same key and value in the same session, can I make the section go out without repeating?
example)
section key value
[app_info] name a
prd_name b
333 555
.ini->
[app_info]
name = a
prd_name = b
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');
}
else
{
WritePrivateProfileString(dataGridView1[0, 8].Value.ToString(), dataGridView1[1, j].Value.ToString(), dataGridView1[2, j].Value.ToString(), @'D:\MCSC_Agent.ini');
}
}
if(dataGridView1==null)
{
}
MessageBox.Show('EXPORT successfully to *.INI format');
}
private void WriteInFile(string section,string key,string value,string path)
{
WritePrivateProfileString(section,key,value,path);
if (value == null)
{
throw new ArgumentException();
}
}
private void button2_Click(object sender, EventArgs e) //ADD_ROW Button
{
DataGridViewButtonColumn button = new DataGridViewButtonColumn();
{
dataGridView1.Rows.Add();
}
}
}
}
Continue reading...
When I enter the URL above,
One thing ... if I have the same key and value in the same session, can I make the section go out without repeating?
example)
section key value
[app_info] name a
prd_name b
333 555
.ini->
[app_info]
name = a
prd_name = b
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');
}
else
{
WritePrivateProfileString(dataGridView1[0, 8].Value.ToString(), dataGridView1[1, j].Value.ToString(), dataGridView1[2, j].Value.ToString(), @'D:\MCSC_Agent.ini');
}
}
if(dataGridView1==null)
{
}
MessageBox.Show('EXPORT successfully to *.INI format');
}
private void WriteInFile(string section,string key,string value,string path)
{
WritePrivateProfileString(section,key,value,path);
if (value == null)
{
throw new ArgumentException();
}
}
private void button2_Click(object sender, EventArgs e) //ADD_ROW Button
{
DataGridViewButtonColumn button = new DataGridViewButtonColumn();
{
dataGridView1.Rows.Add();
}
}
}
}
Continue reading...