110,499
社区成员
发帖
与我相关
我的任务
分享
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.Threading;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 100000; i++)
{
this.dataGridView1.DataSource = getTable(i);
this.dataGridView1.Refresh();
this.dataGridView1.Update();
}
}
public DataTable getTable(int i)
{
DataTable table = new DataTable();
table.Columns.Add("column1", System.Type.GetType("System.String"));
table.Columns.Add("column2", System.Type.GetType("System.String"));
DataRow row = table.NewRow();
row["column1"] = "AXsasas" + i;
row["column2"] = "AAdasdas" + i;
table.Rows.Add(row);
table.AcceptChanges();
return table;
}
private void Form1_Load(object sender, EventArgs e)
{
//getTable();
//this.dataGridView1.DataSource = getTable();
}
}
}