0

我已经搜索了有关此主题的解决方案。但是,我找不到一个。我试图实现这个问题的解决方案答案,但是在向数据网格添加新行时,我得到“System.ArgumentOutOfRangeException:'索引超出范围。必须是非负数并且小于集合的大小。' “ 错误。在插入新行之后,程序在插入新值之前返回到先前选择的行。

private void Datagrid_Registro_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
Registro.RegistroItems row =(Registro.RegistroItems)Datagrid_Registro.SelectedItems[0];

textbox_DocIdentidad.Text = row.DocumentoIdentidad;
comboBox_Ubicaciones.SelectedItem = row.AreaDestino;
textbox_CarnetAsignado.Text = row.CarnetAsignado;
}
4

0 回答 0