DataTable Columns
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;
namespace WindowsFormsTest
{
public partial class Form1 : Form
{
DataTable dt = new DataTable();
public Form1()
{
InitializeComponent();
dt.Columns.AddRange(
new DataColumn[]
{
new DataColumn("Id", typeof(int)),
new DataColumn("Name", typeof(string))
});
dataGridView1.DataSource = dt;
}
private void Form1_Load(object sender, EventArgs e)
{
dt.Rows.Add(1, "AAAA");
dt.Rows.Add(2, "BBBB");
}
}
}