Row associated with the currency manager's position cannot be made invisible
-
hi i add an Unbound DataGridViewCheckBoxColumn to my datagridView for user to select each record that he wants to print (print with DataGridViewPrinter Class), I want to invisible other records that checkbox is False or null, but at RunTime when i set a checkbox to true and uncheck it again (set to false) when i want to invisible that record .. the following error shown me : Row associated with the currency manager's position cannot be made invisible my code is : foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows) { if (_gridViewRow.Cells[0].Value != null) { if (_gridViewRow.Cells[0].Value.ToString() == "True") { _gridViewRow.Visible = true; } else if (_gridViewRow.Cells[0].Value.ToString() == "False") { _gridViewRow.Cells[0].Value = null; ds_zamin1.Khaneh_1.Rows.RemoveAt(_gridViewRow.Index); } } else { _gridViewRow.DataGridView.EndEdit(); _gridViewRow.Visible = false; //Error Occured In this Line } }
-
hi i add an Unbound DataGridViewCheckBoxColumn to my datagridView for user to select each record that he wants to print (print with DataGridViewPrinter Class), I want to invisible other records that checkbox is False or null, but at RunTime when i set a checkbox to true and uncheck it again (set to false) when i want to invisible that record .. the following error shown me : Row associated with the currency manager's position cannot be made invisible my code is : foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows) { if (_gridViewRow.Cells[0].Value != null) { if (_gridViewRow.Cells[0].Value.ToString() == "True") { _gridViewRow.Visible = true; } else if (_gridViewRow.Cells[0].Value.ToString() == "False") { _gridViewRow.Cells[0].Value = null; ds_zamin1.Khaneh_1.Rows.RemoveAt(_gridViewRow.Index); } } else { _gridViewRow.DataGridView.EndEdit(); _gridViewRow.Visible = false; //Error Occured In this Line } }
-
hi i add an Unbound DataGridViewCheckBoxColumn to my datagridView for user to select each record that he wants to print (print with DataGridViewPrinter Class), I want to invisible other records that checkbox is False or null, but at RunTime when i set a checkbox to true and uncheck it again (set to false) when i want to invisible that record .. the following error shown me : Row associated with the currency manager's position cannot be made invisible my code is : foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows) { if (_gridViewRow.Cells[0].Value != null) { if (_gridViewRow.Cells[0].Value.ToString() == "True") { _gridViewRow.Visible = true; } else if (_gridViewRow.Cells[0].Value.ToString() == "False") { _gridViewRow.Cells[0].Value = null; ds_zamin1.Khaneh_1.Rows.RemoveAt(_gridViewRow.Index); } } else { _gridViewRow.DataGridView.EndEdit(); _gridViewRow.Visible = false; //Error Occured In this Line } }
Try this. CurrencyManager cm = CurrencyManager)BindingContext[this.DataGridView1.DataSource]; cm.SuspendBinding(); this.DataGridView1.Rows[index].Visible = false; cm.ResumeBinding();
-
Try this. CurrencyManager cm = CurrencyManager)BindingContext[this.DataGridView1.DataSource]; cm.SuspendBinding(); this.DataGridView1.Rows[index].Visible = false; cm.ResumeBinding();