how do I check if a form is closed?
I want to reload a listview’s items when I close another form.
What I’m doing is:
Form1 = form with ListView
Form2 = form with TextBoxes
- Opening a new form.
- Creating a new folder via a textbox.
- When I press “Add” in Form2 I want to reload the “ListView” on Form1.
So how am I supposed to do this?
And sorry for my bad English :(.
The simplest answer is to make a public method on Form1, let’s call it
RefreshList()and in your button click event on Form2, you simply callForm1.RefreshList. Here’s a quick sample:Form 2:
Form 1:
Initially you mention that you want to do this when Form2 closes, but then later you mention that you want to do it “When I press “Add” in Form2 I want to reload the “ListView” on Form1.” As others have mentioned, you can use the
Closedevent, so I took this approach to address your second case.