日期:2014-05-18 浏览次数:21039 次
public partial class Form1 : Form { public Form1() { InitializeComponent(); this.m_DataSet.Table.ColumnChanged += new DataColumnChangeEventHandler(Table_ColumnChanged); } void Table_ColumnChanged(object sender, DataColumnChangeEventArgs e) { if (e.Column.ColumnName == "A") { if ((bool)e.Row["A"] == true) { e.Row["B"] = "T"; } else { e.Row["B"] = "F"; } } } private void m_GridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { this.m_GridView.CommitEdit(DataGridViewDataErrorContexts.Commit); } } private void m_GridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0 && e.RowIndex !=-1) { this.m_GridView.UpdateCellValue(1, e.RowIndex); } } private void m_GridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { this.m_GridView.CommitEdit(DataGridViewDataErrorContexts.Commit); } } }