D
Dylan Spence
SUMMARY:
I have a project, one of the constraints is that there be a form which
is maximized. Other forms are opened up from the main form in dialog
mode.
When printing from one of the dialoged forms I hide all forms and
display the report, otherwise the report will not show on top of the
dialoged form.
PROBLEM:
If you have mainform [open]-> dialog(1) [open]-> dialog(2) .. then
hide all forms from dialog(2), it works fine. But it will not restore
visiblity to the forms as they were before. It will not show
dialog(2) again. It executes the visibility = true, but it will not
display the form over the dialog(1) screen. This problem extended to
any number of dialogs spawned from dialog(1). I've been through the
code, which was found on the Internet, but have not been able to
compensate.
Has anyone ever done something similiar to this, and succeeded? Any
ideas on how to accomplish this another way?
CODE:
Private loFormArray() As String
Private loform As Form
Private intCount As Integer
Private intX As Integer
Public Sub HideAll()
On Error GoTo Err_HideAll
For Each loform In Forms
If loform.Visible Then
ReDim Preserve loFormArray(intCount)
loFormArray(intCount) = loform.Name
loform.Visible = False
intCount = intCount + 1
End If
Next
Exit_HideAll:
Exit Sub
Err_HideAll:
MsgBox Err.Description
Resume Exit_HideAll
End Sub
Public Sub ShowAll()
On Error GoTo Err_ShowAll
For intX = 0 To intCount - 1 'Step -1
Forms(loFormArray(intX)).Visible = True
Next
ReDim loFormArray(0)
intCount = 0
Exit_ShowAll:
Exit Sub
Err_ShowAll:
MsgBox Err.Description
Resume Exit_ShowAll
End Sub
I have a project, one of the constraints is that there be a form which
is maximized. Other forms are opened up from the main form in dialog
mode.
When printing from one of the dialoged forms I hide all forms and
display the report, otherwise the report will not show on top of the
dialoged form.
PROBLEM:
If you have mainform [open]-> dialog(1) [open]-> dialog(2) .. then
hide all forms from dialog(2), it works fine. But it will not restore
visiblity to the forms as they were before. It will not show
dialog(2) again. It executes the visibility = true, but it will not
display the form over the dialog(1) screen. This problem extended to
any number of dialogs spawned from dialog(1). I've been through the
code, which was found on the Internet, but have not been able to
compensate.
Has anyone ever done something similiar to this, and succeeded? Any
ideas on how to accomplish this another way?
CODE:
Private loFormArray() As String
Private loform As Form
Private intCount As Integer
Private intX As Integer
Public Sub HideAll()
On Error GoTo Err_HideAll
For Each loform In Forms
If loform.Visible Then
ReDim Preserve loFormArray(intCount)
loFormArray(intCount) = loform.Name
loform.Visible = False
intCount = intCount + 1
End If
Next
Exit_HideAll:
Exit Sub
Err_HideAll:
MsgBox Err.Description
Resume Exit_HideAll
End Sub
Public Sub ShowAll()
On Error GoTo Err_ShowAll
For intX = 0 To intCount - 1 'Step -1
Forms(loFormArray(intX)).Visible = True
Next
ReDim loFormArray(0)
intCount = 0
Exit_ShowAll:
Exit Sub
Err_ShowAll:
MsgBox Err.Description
Resume Exit_ShowAll
End Sub