ant*_*009 2 c# datagridview dataset bindingsource
C#2008 SP1.
我正在从datagridview上当前选中的行中删除一行.
我正在使用Typed数据集,我的datagridview被绑定到绑定源.
但是,我认为我的技术并不是最好的,即使它有效.
非常感谢任何建议,
DataRow[] drDelete;
// Get the value of the PK from the currently selected row
DataRowView drv = (DataRowView)bsAddressBook.Current;
int index = Convert.ToInt16(drv[0]);
// Find the actual data row from the primary key and delete the row
drDelete = dsCATDialer.AddressBook.Select(string.Format("ID = '{0}'", index));
dsCATDialer.AddressBook.Rows.Remove(drDelete[0]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10013 次 |
| 最近记录: |