DatagridView Bound to SourceBindingSource - How to clear the grid and reload it?
Posted on 2008-06-23
I have a windows desktop application (VB.NET 2008) and a DataViewGrid. Using the Add Project Data Source to the DataGridView via it's DataGridViewTasks, I have build a BindingSource which is associated with a class within this project.
I add rows to the grid easily with commands like the following:
Me.MyGridSourceBindingSource.Add(MyGridSource.NewMyGridSource(sFileDate, sFileFolder, sFile, CType(sFileSize, Long), bDoesFileExist)). This method returns an object of the class that I based the BindingSource on. All well and good.
The questions are as follows:
1) How to clear the grid for subsequent inserts?
2) How to associate a grid with a bindingsource, modifiy the underlying class and have the changes appear in the grid? At the moment, I seem to have to delete the grid and then attach it to the bindingsource to accomplish that.