0
我想在我的DataGridView中添加以下功能,使其可以選擇兩個或多個單元格並刪除它們的內容(也許右鍵單擊然後選擇刪除)。目前我執行的單元格值更改事件是:C#如何同時選擇和刪除兩個單元格的內容?
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
double currentCellValue;
string PinInGrid = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
if (!double.TryParse(PinInGrid, out currentCellValue))
{
MessageBox.Show("Incorrect input!");
DataTable dt = this.dataGridView1.DataSource as DataTable;
dt.RejectChanges();
return;
}
}
這可能嗎?