1
我有一個DataTable。不同的DataSource到DataGridViewComboBoxCell
CurrencyId |貨幣
0 | USD
1 |泰銖
2 |歐元
5 |盧比
6 |日元
我已經將此表綁定到DataGridViewCombobox單元。用戶可以選擇一種貨幣一次。如果用戶在第一個DataGridViewRow中選擇'USD',則下一行的組合框將不包含'USD'。我能得到它嗎?我試過這個。
private void setCellComboBoxItems(DataGridView dataGrid, int rowIndex, int colIndex, DataTable itemsToAdd)
{
DataGridViewComboBoxCell currencycell = (DataGridViewComboBoxCell)dataGrid.Rows[rowIndex].Cells[colIndex];
currencycell.DataSource = dtCurrency;
currencycell.ValueMember = "CurrencyId";
currencycell.DisplayMember = "CurrencyShortName";
}
我無法修改數據源屬性。我怎麼才能得到它?謝謝。
維護TMP數據表並從數據表中刪除所選擇的值和TMP數據表綁定到''currencycell.DataSource – Damith
當我在TMP數據表結合currencycell.DataSource ,上述單元格的選定值將消失。 @Damith – Zan