方法一:
设置属性:
Control.CheckForIllegalCrossThreadCalls = false;
开启一个新线程
Thread th = new Thread(() => Search(detailID.Trim())); th.IsBackground = true; th.Start();
public void Search(string detailID) { dataGridView1.DataSource =BLLBillConsume.BllGetClearMarketLog_detail(detailID); dataGridView1.Columns[2].DefaultCellStyle.Alignment