I would like to ask someone, even someone has told me it is not possible.

I have a child form2 which is always visible (there is a listView, which shows some data). Then I have a new child form 3 (which is currently opened) and the form3 now does come code (gets some data from the hdd). And when the process is finished I would like to refresh the listView in the form2 (I would like to call a method which refreshes the listView). I was trying that, and the code went over that method, but nothing has happened.
That guy that I was talking aobut on the beginning has told me that it is not possible, because I didn`t call form2.Show(); metod. I can show it, but this is not something that I want to do atm.

So I would like to know, if it`s possible to execute the method for refreshing on the form2, from form3, even if the form2 is not shown? (but the form2 is always visible on form1 - its just not physicly visible if some other form is over it).

7 Years
Discussion Span
Last Post by Geekitygeek

It doesn't matter whether the form is visible or not. I put this form demonstration together for you to see how the forms can manipulate the other forms' lists. Add them to a form project and call Application.Run(new Form_modal())


Or if the method requires and uses visible elements of the form, it may not function properly, am I right? In my case this element is listView.


The code I gave you uses ListBox's, but the principles are the same for ListView as far as modifying the collection of items. When you say "Refresh", I don't know what you mean exactly because it does you no good to perform a ListView.Refresh() if the form is hidden; and, it will occur automatically when the form is shown again.

Did you try the code? And, if there is something I am not understanding in your question, could you post the code or attach your project so I can see what you are trying to do?

I just added listBox1.Refresh() to the add items loop, and it doesn't care whether the form is visible or not... It doesn't error.

Edited by DdoubleD: n/a


The Refresh() method of a control forces it to invalidate its client arrear and redraw itself. If the control is not currently visible (ie, it is underneath another control) then refresh will do nothing. When the control is hidden it is invalidated, and wil redraw itself when it is next made visible.
Am i correct in assuming that form3 is supposed to add items to the listview on Form2 and you are trying to use refresh to show those changes?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.