无法从 'System.Windows.Forms.DataGridViewRow' 转换为 'int'
Cannot convert from 'System.Windows.Forms.DataGridViewRow' to 'int'
当我尝试这样做时:
var row = datagrid.CurrentRow;
name.RemoveAt(row);
(名称是字符串列表)
出现这个错误"Cannot convert from 'System.Windows.Forms.DataGridViewRow' to 'int'"
我需要将行转换为 int 以便删除它。
A DataGridViewRow
不是整数但是你可以得到行的 Index
:
name.RemoveAt(row.Index);
当我尝试这样做时:
var row = datagrid.CurrentRow;
name.RemoveAt(row);
(名称是字符串列表)
出现这个错误"Cannot convert from 'System.Windows.Forms.DataGridViewRow' to 'int'"
我需要将行转换为 int 以便删除它。
A DataGridViewRow
不是整数但是你可以得到行的 Index
:
name.RemoveAt(row.Index);