2

仅当列中存在特定值时,我才想删除网格中的当前行。

如何获取当前行的详细信息?

4

2 回答 2

0

根据您的需要访问 CurrentRow 的 (DataGridViewRow) 单元格或 DataBoundItem 项。您必须将 DataBoundItem 对象转换为强类型数据行。

Dim oRow As FooDataRow = DirectCast(CurrentRow.DataBoundItem, FooDataRow)
于 2010-03-05T01:52:41.587 回答
0

以下代码执行您想要的操作:

// Get the context.
BindingContext context = myGrid.BindingContext;

// Get the currency manager.
BindingManagerBase manager = context [myDataset, "MyTable"];

// Get the current row view.
DataRowView rowView = (DataRowView) manager.Current;

// Assume you have a bit field and want to get its value
bool flag = (bool) rowView ["MyBitField"];

希望这可以帮助。

于 2010-03-05T02:24:08.797 回答