[RESOLVED] Add - Remove Array Textbox,label,ecc
Hi guys,
I have a problem...im able to make array of textboxes ecc...but i cant remove them...listbox has the REMOVE item fucntion...but textboxes and labels dont :(
So do you have any ideas how to REMOVE an array like textbox?
This is my code for adding object arrays :
Code:
Dim intNext As Integer
Dim lngTop As Long
' find the next control
intNext = txtLoadedUser.Count
' find the next top
lngTop = txtLoadedUser(intNext - 1).Top + txtLoadedUser(intNext - 1).Height + 80
' add new controls
Load lblForumName(intNext)
Load txtLoadedUser(intNext)
Load lblWaiting(intNext)
Load txtLoadedPass(intNext)
Load txtSid(intNext)
Load txtU(intNext)
Load txtK(intNext)
With lblForumName(intNext)
.Top = lngTop
.Left = lblForumName(intNext - 1).Left
.Visible = True
End With
With txtLoadedUser(intNext)
.Top = lngTop
.Left = txtLoadedUser(intNext - 1).Left
.Visible = True
.TabIndex = txtLoadedUser(intNext - 1).TabIndex + 2
.Text = ""
End With
CHeers
Re: Add - Remove Array Textbox,label,ecc
You can remove Controls by specifying a single index:
Code:
Unload txtLoadedUser(1)
Or in a loop (for a complete Array):
Code:
Dim lX As Long
For lX = txtLoadedUser.UBound To 1 Step -1
Unload txtLoadedUser(lX)
Next lX
However, you cannot remove items in run time that were added in design time. In your case, 0 - zero.
Creating a completely new Control array in run time requires a more complex solution. Search the forums.
Re: Add - Remove Array Textbox,label,ecc
Thanks for the fast reply...
WIll try that!