C# 无法将datagridview的行可见设置为false
我有一个DatagridViewC# 无法将datagridview的行可见设置为false,c#,C#,我有一个DatagridView 我从一个类设置了它的数据源 taskerEntities te = new taskerEntities(); var OMsMasterDescriptiveIndicators = te.MyTable.Select(x => new lccls {Id = x.Id, name = x.name }).ToList(); MyGrid.DataSource = OMsMasterDescriptiveIndicators; 我的课就像 public
我从一个类设置了它的数据源
taskerEntities te = new taskerEntities();
var OMsMasterDescriptiveIndicators = te.MyTable.Select(x => new lccls {Id = x.Id, name = x.name }).ToList();
MyGrid.DataSource = OMsMasterDescriptiveIndicators;
我的课就像
public class lccls
{
public string Id { get; set; }
public Nullable<decimal> name { get; set; }
}
但我无法做到这一点,因为我认为原因是它是数据源
关联的那么你能帮我怎么做吗?我对这个问题的看法是正确的还是错误的
错误是 无法生成与货币管理器的位置关联的行 无形的 解决办法是
CurrencyManager currencyManager1 = (CurrencyManager)BindingContext[MyGrid.DataSource];
currencyManager1.SuspendBinding();
MyGrid.Rows[5].Visible = false;
currencyManager1.ResumeBinding();
CurrencyManager currencyManager1 = (CurrencyManager)BindingContext[MyGrid.DataSource];
currencyManager1.SuspendBinding();
MyGrid.Rows[5].Visible = false;
currencyManager1.ResumeBinding();