Strange one this. (continuation from other of my threads, search appears to be dead).
What I'm trying to do:
on the main form (Form1) are buttons which the user can add more buttons to. This is from the Remove Buttons form. My psuedo code is:
- store unselected tags in an array (multiselect listbox)
- wipe out all tags the user has created (index>10)
- recreate the tags not selected from the array
It's the readding the buttons bit that's going wrong. It should loop through the array, adding a new button eachtime, but the buttons are appearing all over the place - 1 will appear after the last button where it should, then the rest appear over top to (.top = 0 etc.).
Thanks for any help..
Code:
Public NextVal As Integer
Public DeletedTags(20) As String
Dim i As Integer 'loop counter for storing to the array
Dim j As Integer 'loop counter for deleting every tag
Dim k As Integer 'loop counter for adding tags back to form
Dim AmountDeleted As Integer
If listTags.SelCount > 0 Then
' store all unselected items in an array
For i = listTags.ListCount - 1 To 0 Step -1
If listTags.Selected(i) = False Then
DeletedTags(AmountDeleted) = listTags.List(i)
AmountDeleted = AmountDeleted + 1
End If
Next i
' wipe out every tag the user has created
For j = Form1.lTag().Count - 1 To 10 Step -1
Unload Form1.lTag(Form1.lTag().Count - 1)
Next j
' add all the tags stored in the array back on to the form
[blue]
For k = 0 To AmountDeleted Step 1
NextVal = Form1.lTag().Count
With Form1.lTag(k)
.Container = Form1.frameTags
.Top = Form1.lTag(NextVal - 1).Top + 360
.Left = 120
.Visible = True
.Caption = DeletedTags(k)
.Width = 1815
End With
Next k
[/blue]
End If
What I'm trying to do:
on the main form (Form1) are buttons which the user can add more buttons to. This is from the Remove Buttons form. My psuedo code is:
- store unselected tags in an array (multiselect listbox)
- wipe out all tags the user has created (index>10)
- recreate the tags not selected from the array
It's the readding the buttons bit that's going wrong. It should loop through the array, adding a new button eachtime, but the buttons are appearing all over the place - 1 will appear after the last button where it should, then the rest appear over top to (.top = 0 etc.).
Thanks for any help..