[SOLVED] how to close a non modal window
[SOLVED] how to close a non modal window
I am bringing up a non modal window from code. Sometime later I need to close the non modal window from different code. I just can't figure out how to do this. I tried fWindow.close and no go.
Last edited by sadams54 on Tuesday 21st November 2023 1:21am, edited 1 time in total.
Re: how to close a non modal window
sorry, I solved it myself but here is the answer....
I created a sub to find the window and close it
I created a sub to find the window and close it
Code: Select all
Sub KillLCarsVisual()
Dim D As Window
For Each D In Windows
If d.Name = "FLCARSVisual" Then
d.Close
Endif
Next
End
- BruceSteers
- Posts: 1342
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: [SOLVED] how to close a non modal window
It''l depend on the window creation method to use Close() on the object.
for example
Using
fWindow.Show()
statically to open it should then let you use
fWindow.Close()
But this method for example...
With the above method you will have to use hWin.Close not fWindow.Close but hWin is local to the MakeWin() Function so you would have to use the method you have already come up with.
'
But Then this method should work...
With the above method hWin.Close should work as hWin is a global variable of the open window
for example
Using
fWindow.Show()
statically to open it should then let you use
fWindow.Close()
But this method for example...
Public Sub MakeWin()
Dim hWin As fWindow = New fWindow
hWin.Show()
End
With the above method you will have to use hWin.Close not fWindow.Close but hWin is local to the MakeWin() Function so you would have to use the method you have already come up with.
'
But Then this method should work...
Private hWin As fWindow
Public Sub MakeWin()
hWin = New fWindow
hWin.Show()
End
With the above method hWin.Close should work as hWin is a global variable of the open window
If at first you don't succeed , try doing something differently.
BruceS
BruceS