Help!!! for removing controll added at run time
Dear friends
I have created some controls at run time by using the following code
Private Sub Command1_Click()
Load Text1(Text1.UBound + 1)
Text1(Text1.UBound).Top = Text1(Text1.UBound - 1).Top + 300
Text1(Text1.UBound).Visible = True
End Sub
I also want to remove these controls at run time but I do not know the code for that
Plz!!! help me
Its urgent
Thanks in advance
Re: Help!!! for removing controll added at run time
Unload Text1(Text1.UBound)
Re: Help!!! for removing controll added at run time
Just unload them:
VB Code:
Option Explicit
Private Sub Command2_Click()
Unload Text1(Text1.UBound)
End Sub
Private Sub Form_Load()
Text1(0).Text = ""
End Sub
Private Sub Command1_Click()
Load Text1(Text1.UBound + 1)
Text1(Text1.UBound).Top = Text1(Text1.UBound - 1).Top + 300
Text1(Text1.UBound).Visible = True
End Sub
Re: Help!!! for removing controll added at run time
I have never seen the property UBound for textboxes, is there any? :confused: :confused: :confused:
Re: Help!!! for removing controll added at run time
If they are a control array
Re: Help!!! for removing controll added at run time
Re: Help!!! for removing controll added at run time
If it is a control array it is a collection object with .LBound and .UBound properties. To access each control you need to reference it by index. If it is not an array then it just points to the control itself.