Refresh data from database sqlite in window1

Hi, please, is it possible if I push a button from window1 for open window2 and after I close window2 make possible to refresh data in a listbox from my database in listbox from window1 ?
At present If I push button action in window1 event like this :
Sub btnNew_Action
wWindow1.ShowModal
//After I put this code to refresh data in my listbox after make changes in window2
refreshData
End Sub
!Problem! is if I push btnNew_Action, first I make the call to window2 but the refresh method in window1 is fired before the window 2 has not made the changes.
How can I solve tis problem, please.
Thanks

Why dont you simply move your refresh code to window2 close event?

ShowModal assumes that window 2 is a Modal window. Make sure you set the frame type of window 2 to a modal type.

Hi Tim and Richard, thanks for your help.
I try your recommendations this weekend, have a nice weekend and thanks very much for all your time to help me.

Hi Tim, please take a look to my code, y want only you say me if it is OK.
First code:::::::::::::::::::::::::::::::::::::::::::::
This code is in a button in window1 :
//Create the modal window
dim wCont As new wContactos //wContactos is window2
//I put the title…
wCont.Title = wCont.Title + " / Aadiendo un nuevo contacto…"
//I happened 2 parameters to //wContactos
wCont.TipoRegistro(“Nuevo”,totCalcIDCont)
//And I show modal the window wContactos
wCont.ShowModal

//After wContactos is close this is the code to refresh data from sqlite database in listbox in window1
CargoContactos

If I put this code everything works well.

Second code:::::::::::::::::::::::::::::::::::::::::::::
If I put his codeine window1, the form window2 opens 2 x the window2 :
//I put the title…
window1.Title = window1.Title+" / Aadiendo un nuevo contacto…"
//I happened 2 parameters to //window2
window2.TipoRegistro(“Nuevo”,totCalcIDCont)
window2.ShowModal

The second code opens 2 x the window2, can you explain the reason please.
Thanks