3
Reply

Duplicating a Form Component? Cloning etc...

write2jey

write2jey

Feb 7 2005 5:46 PM
7.8k
I'm trying to duplicate a form componenet such as a ListView or TextBox from one TabPage to the other. I've found two viable solutions so far.... 1) Cloning implementing ICloneable 2) Inheriting from the specified Component and derving the class. Would anyone elaborate the Cloning part? I'll give a head start: But the following throws a stack exception as it goes on in a loop. class RemoteListView:ICloneable { private ListView m_ListView, m_ListClone; //the object I need cloning public RemoteListView (ListView lv) { m_ListView = lv; } public object Clone() { RemoteListView view = new RemoteListView (m_ListView); view.m_ListClone = (ListView)view.Clone(); return view; } } Any input would be much appreciated!! JJ

Answers (3)