write2jey

write2jey

  • NA
  • 69
  • 0

Duplicating a Form Component? Cloning etc...

Feb 7 2005 5:46 PM
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)