Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to update datagrid view when bringing a form from background to foreground?
    primarykey
    data
    text
    <p>here i have a form which contains a datagrid view and three buttons namely edit,delete and back. intially when i am loading the form it is showing the correct data in the datagrid, but suppose if i edit or delete a record by clicking on either edit or delete button and when this form comes to foreground after performing these operations the datagrid view isn't showing the updated data. Any help would be welcome..... note- this form does not closes when i click edit or delete button it simply goes into background. My code is as follows:-</p> <pre><code>namespace RDASMS { public partial class LoginDb : Form { DataTable dt = new DataTable(); public LoginDb() { InitializeComponent(); } //OleDbConnection vcon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\workspace\RDASMS\RDASMS\rdadb.mdb"); public Form ReferToAdmin { get; set; } private void LoginDb_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'rdadbDataSet1.login' table. You can move, or remove it, as needed. // this.loginTableAdapter.Fill(this.rdadbDataSet1.login); // TODO: This line of code loads data into the 'rdadbDataSet.login' table. You can move, or remove it, as needed. //this.loginTableAdapter.Fill(this.rdadbDataSet.login); MyOleDbConnection.Open(); DataSet ds = new DataSet(); //DataTable dt = new DataTable(); ds.Tables.Add(dt); OleDbDataAdapter da = new OleDbDataAdapter(); da = new OleDbDataAdapter("select * from login", MyOleDbConnection.vcon); /*da.Fill(dt); logindb_dataGridView.DataSource = dt.DefaultView;*/ da.Fill(dt); logindb_dataGridView.DataSource = dt; logindb_dataGridView.AutoResizeColumns(); MyOleDbConnection.Close(); } private void logindb_panel_Paint(object sender, PaintEventArgs e) { } private void logindbback_Click(object sender, EventArgs e) { this.Close(); this.ReferToAdmin.Show(); } private void logindbdelete_Click(object sender, EventArgs e) { DeleteRecord dr = new DeleteRecord(); dr.ReferToLogindb = this; dr.Show(); this.Hide(); } private void logindbedit_Click(object sender, EventArgs e) { EditRecord er = new EditRecord(); er.ReferToLogindb = this; er.Show(); this.Hide(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload