Hi all, I am having an odd problem with objects in a control array. I can load then fine, but for some reason, I cannot call the unload command where I want to. I have a combobox where, when the user selects "End" all of the control array components beyond that unload. But, when I try to do that, I get a "unable to unload within this context" error. Just for grins, I made a test button with only the unload command in it, and that works fine... it is exactly the same command? Can anyone see what I am missing here? Below is the code of the components in question:
----------------------------------------------
Private Sub Andor_Click(I As Integer)
Dim X As Integer
If (Andor(I).Text = "And") Or (Andor(I).Text = "Or") Then
If (I = Conditions) And (Conditions < 5) Then
Loading con(I + 1), I
Fillcon con(I + 1)
Loading Eqnoteq(I + 1), I
Filleq Eqnoteq(I + 1)
Loading Group(I + 1), I
FillGroup Group(I + 1)
Loading Lab(I + 1), I
Filllab Lab(I + 1)
Loading Loc(I + 1), I
Filllocation Loc(I + 1)
Loading Size(I + 1), I
FillSize Size(I + 1)
Loading Andor(I + 1), I
FillAO Andor(I + 1)
Loading Sysarc(I + 1), I
Filllab Sysarc(I + 1)
Loading Smlabel(I + 1), I
Loading Criti(I + 1), I
Loading smcriti(I + 1), I
Conditions = Conditions + 1
Con_Click (I + 1)
End If
Else
If (Andor(I).Text = "End") And (Conditions > 1) And (Conditions > I) Then
For X = Conditions To (I + 1)
Unload con(X)
Unload Eqnoteq(X)
Unload Group(X)
Unload Lab(X)
Unload Loc(X)
Unload Size(X)
Unload Andor(X)
Unload Sysarc(X)
Unload Smlabel(X)
Unload Criti(X)
Unload smcriti(X)
Next X
Conditions = I
End If
End If
End Sub
---------------------------------------------
Private Function Loading(ByRef CB, I)
Load CB
CB.Top = CB.Top + (360 * I)
CB.Visible = True
End Function
---------------------------------------------
Private Sub Com_Click(I As Integer)
Unload con(Conditions)
End Sub
---------------------------------------------
the Com_click is the on that works fine... there are no parent-child relationships here, and everything is on the same form and all that...
Anyone see any problems, or have any ideas?
Fion
----------------------------------------------
Private Sub Andor_Click(I As Integer)
Dim X As Integer
If (Andor(I).Text = "And") Or (Andor(I).Text = "Or") Then
If (I = Conditions) And (Conditions < 5) Then
Loading con(I + 1), I
Fillcon con(I + 1)
Loading Eqnoteq(I + 1), I
Filleq Eqnoteq(I + 1)
Loading Group(I + 1), I
FillGroup Group(I + 1)
Loading Lab(I + 1), I
Filllab Lab(I + 1)
Loading Loc(I + 1), I
Filllocation Loc(I + 1)
Loading Size(I + 1), I
FillSize Size(I + 1)
Loading Andor(I + 1), I
FillAO Andor(I + 1)
Loading Sysarc(I + 1), I
Filllab Sysarc(I + 1)
Loading Smlabel(I + 1), I
Loading Criti(I + 1), I
Loading smcriti(I + 1), I
Conditions = Conditions + 1
Con_Click (I + 1)
End If
Else
If (Andor(I).Text = "End") And (Conditions > 1) And (Conditions > I) Then
For X = Conditions To (I + 1)
Unload con(X)
Unload Eqnoteq(X)
Unload Group(X)
Unload Lab(X)
Unload Loc(X)
Unload Size(X)
Unload Andor(X)
Unload Sysarc(X)
Unload Smlabel(X)
Unload Criti(X)
Unload smcriti(X)
Next X
Conditions = I
End If
End If
End Sub
---------------------------------------------
Private Function Loading(ByRef CB, I)
Load CB
CB.Top = CB.Top + (360 * I)
CB.Visible = True
End Function
---------------------------------------------
Private Sub Com_Click(I As Integer)
Unload con(Conditions)
End Sub
---------------------------------------------
the Com_click is the on that works fine... there are no parent-child relationships here, and everything is on the same form and all that...
Anyone see any problems, or have any ideas?
Fion