Unable To set row visible false of a datagridview

后端 未结 6 1626
北荒
北荒 2020-11-27 05:55

I have a DataGridView where I set DataSource:

taskerEntities te = new taskerEntities();
var OMsMasterDescriptiveIndicators = te.MyT         


        
6条回答
  •  生来不讨喜
    2020-11-27 07:01

    Cannot set yourDataGridView row visible property to false when current row index Will encounter such error if trying to hide current cell

    soulution :

    when yourDataGridView Data source is not null :

      CurrencyManager currencyManager1 = (CurrencyManager)BindingContext[yourDataGridView.DataSource];
                           currencyManager1.SuspendBinding();
                           yourDataGridView.Rows[Target Index].Visible = false;
                           currencyManager1.ResumeBinding();
    

    when yourDataGridView Data source is null :

     yourDataGridView.CurrentCell = null;
     yourDataGridView.Rows[Target Index].Visible = false;
    

提交回复
热议问题