一个动态生成的DATAGRIDVIEW,绑定了一个动态生成的DATASET,请问如何指定DATAGRIDVIEW的某一列为DATAGRIDVIEWBUTTONCOLUMN?

解决方案 »

  1.   

    this.dataGridView1.Controls.Add(btn);void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
      {
      if (e.Control is Button)
      {
      Button btn = e.Control as Button;
      btn.Click -= new EventHandler(btn_Click);
      btn.Click += new EventHandler(btn_Click);
      }
      }
      void btn_Click(object sender, EventArgs e)
      {
      int col = this.dataGridView1.CurrentCell.ColumnIndex;
      int row = this.dataGridView1.CurrentCell.RowIndex;  }