|
-
Dec 17th, 2003, 10:22 AM
#1
Thread Starter
Hyperactive Member
Copying an existing control...
Hey everyone,
I know this is a common question, and I apologize, but I searched the forum and couldn't find an appropriate response.
I've already got one listview on my form, and depending on the situation, when this form opens it may have any number of additional listviews. I'd like to dynamically load them and have all the same properties as the listview that is already on the form.
I tried:
Code:
Dim lvTemp as New lvGE
'lvGE is the Listview control that is already on, and always on my form
With no success. What am I missing?
Thanks!
--Ben
-
Dec 17th, 2003, 11:58 AM
#2
Hyperactive Member
You have to add it to the controls collection of the form
don't have code to hand, but the form is the parent control and search for words like parent control add and something should come up to give you the answer
-
Dec 17th, 2003, 03:32 PM
#3
Thread Starter
Hyperactive Member
Sorry for not being more specific.
I am adding it to the controls collection, but it's the DIM line that's erroring out. Won't compile it.
--Ben
-
Dec 17th, 2003, 03:51 PM
#4
VB Code:
Dim lvTemp as ListView = DirectCast(lvGE , ListView)
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Dec 17th, 2003, 03:57 PM
#5
Originally posted by dynamic_sysop
VB Code:
Dim lvTemp as ListView = DirectCast(lvGE , ListView)
Actually this will make a second reference to the same listview not copy/duplicate one. There is no simple method to copy a control. You can either recreate it (run the code that the IDE generates that creates it), or in some cases you can serialize it to copy it. However I don't think the ListView control is serializable.
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
|