Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
How to refresh Wingrid on "Parent" Windows Form?
posted

I have a Wingrid on my main Windows form.  Each row has a checkbox column.  The user selects rows by marking the checkboxes.  If they wish to apply an update to all of the selected rows,  a "Global Update" needs to be applied.  I provided a "Global Update" button on the main form (not in the grid).  Clicking the "Global Update" button opens a separate Windows form.  The user enters data values on the Global Update form and clicks the "Save" button.  Problem is...after the user clicks the "Save" button, I am not able to get the grid on the (underlying) main Windows form, which I'm calling the "Parent" form, to refresh and display the newly-updated values!  I'm hoping there's a way to refresh the grid so that the new values display in the grid when the user closes the Global Update form. 

This is the code that runs when the user clicks the "Global Update" button on the main Windows form.  This opens the "Global Update" form:

private void btnGlobalUpdate_Click(object sender, EventArgs e)
{
   //*** RMSStatic are static variables.  Save active grid and "button clicked" flag. 
    RMSStatic.activeGrid = "FILES";
    RMSStatic.keepGrid = this.ultraGridRecordsTempVW;
    RMSStatic.gu_filebutton_clicked = true;

   //*** Define a new instance of the Global Update form object 
    RMSTestWithLogin.
GlobalUpdate g = new RMSTestWithLogin.GlobalUpdate();

   //*** "rmsd" variable is defined as this type in the GlobalUpdate class = "public RMSDataSet rmsd"
    g.rmsd = rMSDataSet;
  // this will display the Global Update form
    g.ShowDialog();

   //The DataBind() and Refresh() are not refreshing the grid data.  When user closes the Global Update form, nothing happens.  Grid display stays
   the same. 
    this
.ultraGridRecordsTempVW.DataBind();
    this.ultraGridRecordsTempVW.Refresh();
}

Should I be refreshing the values in the grid differently??? 



Parents
No Data
Reply
  • 37774
    posted

    Assuming that the main grid is bound to the same DataSet ('rMSDataSet'), I would think that the values should get updated automatically; perhaps they aren't because the binding contexts after different.  Still, calling DataBind is not going to do anything here, and calling Refresh will only cause the grid to get repained, but not get the data again.  You might want to try the grid.Rows.Refresh method, passing in ReloadData for the argument.

    -Matt

Children
No Data