|
-
Jun 23rd, 2002, 10:16 AM
#1
Thread Starter
New Member
control arrays 2
i dont want to create the control array to hadle events.
i need to create copies of an existing control with its properties at run time. how can i do that if there r no control arrays in vb.net?
-
Jun 23rd, 2002, 11:03 AM
#2
Hyperactive Member
All you have to do is create a new reference of the control. For example if you have a textbox called TextBox1 then:-
Dim tbNew as New TextBox1
tbNew.Text = "Copy of TextBox1"
tbNew.Location = New System.Drawing.Point(12, 12)
Me.Controls.Add(tbNew)
Don't make the mistake of ignoring the value of AddHandler. Your question is based on a technique in VB6 where you had to place control on the form to allow the programmatic creation of a control array. You don't have to do this anymore so you shouldn't still be thinking in those terms.
I have done an example of creating controls, using buttons, on the fly and using one procedure to capture the click event of all of them:-
http://www.developerfusion.com/show/2499/
Eventually you'll see that you just don't need control arrays anymore.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|