sethindeed
10-04-2001, 08:50 AM
Hello,
OK, here is my problem.
I am coding a program which contains an MDIForm and two types of MDIChild forms : Queries and Templates. I load both of those forms with arrays ( i.e frmTemplate ( i ) ). I have indexes that keeps track of the total, current and childcount indexes. The project is working quite well, the only concern left is the following one :
When I am unloading a Template form, in the QueryUnload Event, I am coding :
TotalTemplate = TotalTemplate - 1
And when I am loading a new Template occurence, I am coding :
frmTemplate ( TotalTemplate ).Show
TotalTemplate = TotalTemplate + 1
I am getting to the problem, just want to give you as much informations as possible...
When doubleclicking on a grid, I am calling the following routine to find out if a particular template is already in memory :
Private Sub MSFlexGrid1_DblClick()
If MSFlexGrid1.MouseRow <> 0 Then
If MSFlexGrid1.Rows > 1 Then
If MSFlexGrid1.TextMatrix(1, 1) <> "" Then
MSFlexGrid1.Enabled = False
For aCounter = 1 To TotalTemplate - 1
TempBug = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
frmTemplate(aCounter).IfOpen (TempBug)
If ResultB = True Then
Exit For
End If
Next aCounter
If ResultB = True Then
frmTemplate(aCounter).WindowState = 0
frmTemplate(aCounter).SetFocus
Else
ReDim Preserve frmTemplate(1 To TotalTemplate)
TempBugIdent = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
TemplateType = "DoubleClick"
frmTemplate(TotalTemplate).Show
TotalTemplate = TotalTemplate + 1
ChildCount = ChildCount + 1
End If
MSFlexGrid1.Enabled = True
End If
End If
End If
End Sub
The problem with this routine is that in the For Next loop, the program will call this coded line:
frmTemplate(aCounter).IfOpen (TempBug)
...which means it will look in frmTemplate( 1 ), frmTemplate ( 2 ), frmTemplate ( 3 )...
...But if I opened 4 occurences of frmTemplate, then closed the third one, there will be three checks ( which is correct ), but when it will call frmTemplate ( 3 ), it will look to the old frmTemplate unloaded instead of having dynamically reassigned frmTemplate ( 4 ) to frmTemplate ( 3 ).
If you are still following, is there a way to dynamically reassign form indexes when certain forms are unloaded, to keep the workflow functionnal ?
Thank you very much :)
OK, here is my problem.
I am coding a program which contains an MDIForm and two types of MDIChild forms : Queries and Templates. I load both of those forms with arrays ( i.e frmTemplate ( i ) ). I have indexes that keeps track of the total, current and childcount indexes. The project is working quite well, the only concern left is the following one :
When I am unloading a Template form, in the QueryUnload Event, I am coding :
TotalTemplate = TotalTemplate - 1
And when I am loading a new Template occurence, I am coding :
frmTemplate ( TotalTemplate ).Show
TotalTemplate = TotalTemplate + 1
I am getting to the problem, just want to give you as much informations as possible...
When doubleclicking on a grid, I am calling the following routine to find out if a particular template is already in memory :
Private Sub MSFlexGrid1_DblClick()
If MSFlexGrid1.MouseRow <> 0 Then
If MSFlexGrid1.Rows > 1 Then
If MSFlexGrid1.TextMatrix(1, 1) <> "" Then
MSFlexGrid1.Enabled = False
For aCounter = 1 To TotalTemplate - 1
TempBug = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
frmTemplate(aCounter).IfOpen (TempBug)
If ResultB = True Then
Exit For
End If
Next aCounter
If ResultB = True Then
frmTemplate(aCounter).WindowState = 0
frmTemplate(aCounter).SetFocus
Else
ReDim Preserve frmTemplate(1 To TotalTemplate)
TempBugIdent = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
TemplateType = "DoubleClick"
frmTemplate(TotalTemplate).Show
TotalTemplate = TotalTemplate + 1
ChildCount = ChildCount + 1
End If
MSFlexGrid1.Enabled = True
End If
End If
End If
End Sub
The problem with this routine is that in the For Next loop, the program will call this coded line:
frmTemplate(aCounter).IfOpen (TempBug)
...which means it will look in frmTemplate( 1 ), frmTemplate ( 2 ), frmTemplate ( 3 )...
...But if I opened 4 occurences of frmTemplate, then closed the third one, there will be three checks ( which is correct ), but when it will call frmTemplate ( 3 ), it will look to the old frmTemplate unloaded instead of having dynamically reassigned frmTemplate ( 4 ) to frmTemplate ( 3 ).
If you are still following, is there a way to dynamically reassign form indexes when certain forms are unloaded, to keep the workflow functionnal ?
Thank you very much :)