无法设置DataGridView的一行可见假 [英] Unable To set row visible false of a datagridview
本文介绍了无法设置DataGridView的一行可见假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个DataGridView
我已经设置其数据源从一个类
taskerEntities TE =新taskerEntities();
VAR OMsMasterDescriptiveIndicators = te.MyTable.Select(X =>新建lccls {ID = x.Id,名称= x.name})了ToList()。
MyGrid.DataSource = OMsMasterDescriptiveIndicators;
我的班级像
公共类lccls
{
公共字符串ID {搞定;组; }
公众可空<&小数GT;名称{;组; }
}
在一个特定的事件,我想假可见当前行
MyGrid.Rows [5]。可见=虚假的;
不过,我不能这样做,因为我想原因是它的数据源
相关
所以,可以请你帮助我,我如何能做到这一点,无论我如何看待这个问题的正确与否
该错误是
与货币经理的位置相关联的行无法进行
无形
块引用>解决方案搜索了很多之后,我得到了解决。
的CurrencyManager currencyManager1 =(CurrencyManager的)的BindingContext [MyGrid.DataSource]
currencyManager1.SuspendBinding();
MyGrid.Rows [5]。可见=虚假的;
currencyManager1.ResumeBinding();I had a DatagridView
I had set its datasource From A classtaskerEntities te = new taskerEntities(); var OMsMasterDescriptiveIndicators = te.MyTable.Select(x => new lccls {Id = x.Id, name = x.name }).ToList(); MyGrid.DataSource = OMsMasterDescriptiveIndicators;
My Class is Like
public class lccls { public string Id { get; set; } public Nullable<decimal> name { get; set; } }
At a certain event i want to Visible false The Current Row
MyGrid.Rows[5].Visible = false;
But I am unable To do this because i think the reason Is It's
datasource
associated
So can you Please help me how Could I do this and Whatever I think About This Problem Is correct Or not
The Error isRow associated with the currency manager's position cannot be made invisible
解决方案After searching a lot, I got the solution
CurrencyManager currencyManager1 = (CurrencyManager)BindingContext[MyGrid.DataSource]; currencyManager1.SuspendBinding(); MyGrid.Rows[5].Visible = false; currencyManager1.ResumeBinding();
这篇关于无法设置DataGridView的一行可见假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文