日期:2014-05-18  浏览次数:20704 次

多线程与DataGridView的问题,请帮忙

  partial class Form2
  {
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private System.ComponentModel.IContainer components = null;

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
  protected override void Dispose(bool disposing)
  {
  if (disposing && (components != null))
  {
  components.Dispose();
  }
  base.Dispose(disposing);
  }

  #region Windows 窗体设计器生成的代码

  /// <summary>
  /// 设计器支持所需的方法 - 不要
  /// 使用代码编辑器修改此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
  this.GetDataB = new System.Windows.Forms.Button();
  this.DataDGV = new System.Windows.Forms.DataGridView();
  this.QueryTB = new System.Windows.Forms.TextBox();
  this.ResultL = new System.Windows.Forms.Label();
  ((System.ComponentModel.ISupportInitialize)(this.DataDGV)).BeginInit();
  this.SuspendLayout();
  // 
  // GetDataB
  // 
  this.GetDataB.Location = new System.Drawing.Point(11, 12);
  this.GetDataB.Name = "GetDataB";
  this.GetDataB.Size = new System.Drawing.Size(75, 23);
  this.GetDataB.TabIndex = 0;
  this.GetDataB.Text = "获取数据";
  this.GetDataB.UseVisualStyleBackColor = true;
  this.GetDataB.Click += new System.EventHandler(this.button1_Click);
  // 
  // DataDGV
  // 
  this.DataDGV.BackgroundColor = System.Drawing.SystemColors.ActiveCaptionText;
  this.DataDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  this.DataDGV.Location = new System.Drawing.Point(1, 53);
  this.DataDGV.Name = "DataDGV";
  this.DataDGV.RowTemplate.Height = 23;
  this.DataDGV.Size = new System.Drawing.Size(556, 412);
  this.DataDGV.TabIndex = 1;
  // 
  // QueryTB
  // 
  this.QueryTB.Location = new System.Drawing.Point(109, 12);
  this.QueryTB.Name = "QueryTB";
  this.QueryTB.Size = new System.Drawing.Size(438, 21);
  this.QueryTB.TabIndex = 2;
  this.QueryTB.Text = "select * from Person.Address";
  // 
  // ResultL
  // 
  this.ResultL.AutoSize = true;
  this.ResultL.Location = new System.Drawing.Point(107, 38);
  this.ResultL.Name = "ResultL";
  this.ResultL.Size = new System.Drawing.Size(77, 12);
  this.ResultL.TabIndex = 3;
  this.ResultL.Text = "获取数据 条";
  // 
  // Form2
  //