我无法获得当前行值。我能怎么做?
bindingSource1.DataSource = LData; (LData is Generic List)
public DataRow currentRow
{
get
{
int position = this.BindingContext[bindingSource1].Position;
if (position > -1)
{
return ((DataRowView)bindingSource1.Current).Row;
}
else
{
return null;
}
}
}
我无法获得当前行:
MessageBox.Show(currentRow["NAME"].ToString());
出现错误:InvalidCastException,我该怎么办?谢谢。