how to detect the closing of a form

elloco999

Well-known member
Joined
Dec 21, 2004
Messages
49
Programming Experience
5-10
Hi,

I was just wondering how to detect when the 2nd form of my app closes.

I have a small app that opens a second form when you click a button. In the new form, you can add some information to a text file, that is used to fill a combobox in the first form. When you click the add button, the information is added and the form is closed.

The problem is that the first form doesn't show the new information in the combobox until I either manually call the refill command, or the app is restarted (it fills the box for the first time when the app starts).

So, how do I detect, from the first form, that the second form closes, so that I can call the refill command.

Greets,
EL Loco
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
in the closing or closed event of the 2nd form have it call a function in the 1st form (the function in the 1st form will need to have a friend/public scope) in which it has the combobox refresh/refill
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Personally I'd use a seperate sub for the fill so you can call it once the second form is closed. Then when you call the form use showdialog (instead of show) and on the next line call the sub.

TPM
 
Top Bottom