日期:2014-05-18 浏览次数:20791 次
private void dataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (e.Control is DataGridViewTextBoxEditingControl) { DataGridViewTextBoxEditingControl tb = (DataGridViewTextBoxEditingControl)e.Control; tb.TextChanged += new EventHandler(cellValueChanged); } } private void cellValueChanged(object sender, EventArgs e) { DataGridViewTextBoxEditingControl textBox = (DataGridViewTextBoxEditingControl)sender; if (!textBox.Text.Trim().Equals("")) { MessageBox.Show(textBox.Text); } }
private void dataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if(dataGridView1.CurrentCell.ColumnIndex==1 && dataGridView1.CurrentCell.RowIndex!=-1) //控制行、列 { if (e.Control is DataGridViewTextBoxEditingControl) { DataGridViewTextBoxEditingControl tb = (DataGridViewTextBoxEditingControl)e.Control; tb.TextChanged += new EventHandler(cellValueChanged); } } }