0
我有一个datagridview,当它加载第一行被选中。我想删除一条记录,但我不想第一行选择。我想要给用户的消息,首先选择一行然后点击删除按钮。我尝试这些代码,但他们不工作。删除默认行选择datagridview
//kharidDataGridView.Rows[0].Selected = false;
//kharidDataGridView.ClearSelection();
//kharidDataGridView.CurrentCell = null;
我在WPF使用下面的代码:
object item = datagrideview1.SelectedItem;
if (item == null)
{
//message to user
}
谢谢
执行ClearSelection删除默认选中的行 – Isma
在DataBind之后调用ClearSelection()和CurrentCell = null –