c# - Removing rows from dataGridView-using dataTable -


I'm trying to remove all the rows to reload them (I need to remove all the rows) Due to not removing them from my datagrid view (although not adding any additional additions to it) nothing is happening. I have tried many different ways, I know I have done this in the past (probably the day's Due to the end)

This mer Code, it is trying a whole bunch of deletion

  private void loadMSXGridView () {BindingSource bs = new BindingSource (); Dgv.DataSource = null; Dgv.Refresh (); Bs.DataSource = GetTable (); Dgv.DataSource = BS; Dgv.Column [0] .Width = 391; Dgv.Column [1] .Width = 30; } Private Datatable GetTable () {DataTable t = New DataTable (); T.Rows.Clear (); T.AcceptChanges (); T.Columns.Add ("account line", typef (string)); T.Columns.Add ("#", typef (string)); Foreign (AMAPnr.RemarkElement in AMAPnr._RemarkElements again) {if (ElementID == "Rm" & amp; amp; F.F.F. with Wires ("* MS") {DataGridViewCell gridclass text; Datagreat electricity grid cell element; GridCellText = New DataGridViewTextBoxCell (); GridCellText.Value = Redo Freeflow; Gridcaleelment = new datagridviewtextbox (); Grid cell element. Value = Re. No Element Toasting (); T.Rows.Add (Grid CellText.Value, gridCellElement.Value); }} Return T; }   

My deleted button loads the load MSXGridView, I just need to refresh everything because the items in my datagrid view are linked to the element number, which will not be the same

Initially, you are binding data:

  dgv.DataSource = GetTable ( );   

You must continue data binding; Either specify the table to clean itself (and repeat the data again), or different data-table dgv.DataSource .

Comments