Click here to Skip to main content
15,665,480 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have an application with two forms.

The main form contains 2 labels, one grid (filled with data from a List<class>) and some checkbox to select filters on the data.

The second form (named OverheadWin) contains the same 2 labels and the grid filled with the same data. Its purpose is only to show the information maximized on an extended monitor.

The application works well but the only method that I found to update the second form is closing and reopening it.

I would like to find a more convenient way to refresh the information in the second form from the main form, but so far all the solutions that I tried (like ohdWin.Reresh()) do not work.

I have also tryed with a background worker in the second form that periodically updates the data, but I did not succeed (maybe I do something wrong). The results of my trials were the second form freezed (there is a displacement bar that should work), or the window closing just after opening (the main mehtod of that second form runs only once and the window closes once reached the end of this method).

The current code of the first form is
public partial class MainWin : Form
    OverheadWin ohdWin;

private void OpenOhdWin()
    ohdWin = new OverheadWin();

The update part, to be improved

The main method of the second form: (OhdGridShow shows the data in the label and the grids)
public partial class OverheadWin : Form
    public OverheadWin()    

Any idea will be welcome.

Thank you in Advance,

1 solution

Inside Form 2:--

Create a public function name say RefreshGrid.

Public void RefreshGrid()
DataGridViewObject.DataSource = null;
DataGridViewObject.DataSource = dataTable;

Call This Function after adding data from first form with the existing object of form2.

Hope you can try this.
Share this answer
NeueStudium2012 3-Apr-13 2:28am    
It works fine. Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900