|
-
Jun 28th, 2002, 01:08 AM
#1
Thread Starter
New Member
control arrays 4
thanx for the replies guys but i didnt get what i want yet.
i want to create copies of an existing control with its same properties not new controls.
the following code doesnt work although its very logical.
Dim tbNew as New TextBox1
tbNew.Text = "Copy of TextBox1"
tbNew.Location = New System.Drawing.Point(12, 12)
Me.Controls.Add(tbNew)
and to make my point clear, i dont want to create a pointer to an existing control or another control of the same type. I WANT A COPY OF AN EXISTING CONTROL WITH ITS PROPERTIES JUST AS WE USED TO DO WITH CONTROL ARRAYS IN VB6.
-
Jun 28th, 2002, 01:16 AM
#2
first, plz post your replies to one thread, you dont need to click on the new thread button, just click on post reply and post all the things in one single thread....
second, did you try that one? didnt work?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jun 28th, 2002, 01:36 AM
#3
Thread Starter
New Member
Create a copy of a control at run-time
We are trying to create a copy of a control and all its properties at runtime. The problem is that there are no control arrays as in VB6, and we cannot issue the command
Dim tb as New Textbox1 (for Textbox1 being the control we want to copy)
and Dim tb as Textbox = textbox1 doesn't work cause we will have to issue the next command tb = New Textbox (and cannot issue tb = New Textbox1)
And the big problem is that there is no Clone method for the object Control.
How to solve this problem?
If you have an idea, your help will be most appreciated
Thanks!
-
Jun 28th, 2002, 01:46 AM
#4
I dont know how exactly to copy a control the way you want, but you can just do it manually
dim tb as new textbox
tb.text = textbox1.text
.....
me.controls.add(tb)
you can also do something like this
dim tb() as new textbox
fill up the array with different textboxes
then do this
me.controls.addrange(tb)
HTH
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
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
|