I have reload the data for data grid view
each time the form
open.
Student_DetailEntities db = new Student_DetailEntities();
private void Form1_Load(object sender, EventArgs e)
{
db.StudentTables.Load();
studentTableBindingSource.DataSource = db.StudentTables.Local;
}
To ensure the data table
is refresh
and show
in data grid view
, I have tried this code
private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Restart();
Environment.Exit(0);
}
and I try
private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Controls.Clear();
this.InitializeComponent();
}
But the data grid view
still not reload
. Each time I add
new item
, I need to close
and open
the form
again for it to show in data grid view
.