-
Syntax to test if a form is open...
[Originally posted by Don Brown]
Does anyone know what the syntax would be for testing to see if a form is open?* I want to be able to ask if a user wants to save their data only if a form is open and has changes to it.
-
Re:Syntax to test if a form is open...
[Originally posted by oliver bertrand]
--Just use the .VISIBLE Method--
Private Sub Command1_Click()
If FORMNAME.VISIBLE = TRUE then
* (stick code here)
else
* (do something else)
end if
Exit Sub
It works for me, i set up 2 forms, 2 command buttons on form1.* One opens form2, the other checks to see if it is visible.* If you hide the forms or load them without showing, you may need to try some more indepth coding but this will generally work.* Hope it helps
-
Re:Re:Syntax to test if a form is open...
[Originally posted by Don Brown]
I assume it doesn't matter if the form is a child form within an MDI?
-
Re:Syntax to test if a form is open...
[Originally posted by yoshi]
try this code
function IsFormVisible(FormName as string)boolean
dim Frm as Form
for each frm in forms
* IsFormVisible=false
* if frm.name = FormName and Frm.visible = true then
* IsFormVisible=True
* exit for
end if
next frm
end funcion
''Usage
if IsformVisible("FrmWhatEver")=true then
'write your code here if visible
else
'write your code here if not
endif
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|