I'm working on a desktop application windows form
, when I close a UserControl
I do it in the following way.
private void _proveedor_ProveedorClose(object sender, EventArgs e)
{
pnlPiso.Controls.Remove(_proveedor);
dgvHelper.DataSource = null;
}
The UserControl
that I use call them to a panel that serves as floor as the pnlPiso
.
But the funny thing is that in UserControl
I have a DGV loaded with 10 records. Then I go to the db and manually delete 5 records, I close the UserControl
with the code that I show up lines and when I call again the UserControl
shows me in the DGV 10 records but if it should only show 5 records.
Note: the dgvHelper
is from another DGV that has nothing to do with the DGV that I am mentioning.
How should I destroy or erase from memory the UserControl
so that when I call it again, it shows me the real data?
I can only see the real data when I leave the visual studio and flight to open the app.