Hi guys, Here is what I'd like to do (in C#):
I have a class CMyClass, it looks like this: public class CMyClass { #region Private members private ListView m_lvP; // listview associated w/ the class private ColumnHeader m_chA; // column header private ColumnHeader m_chB; // column header private ColumnHeader m_chC; // column header #endregion #region Public members /// <summary> /// Constructor /// </summary> public CPanel ( ListView lvP ) { if ( lvP != null ) // the listview reference cannot be NULL { m_lvP = lvP; m_chName = new ColumnHeader (); m_chSize = new ColumnHeader (); m_chDate = new ColumnHeader (); /// ... } } #endregion } In a form, I want to have two instances of this class, as a two-element array of CMyClass type, so I make a declaration: public class frmMain : System.Windows.Forms.Form { private CMyClass[] m_oMyObjs; private System.Windows.Forms.ListView lvP1; // this listview should be associated w/ m_oMyObjs public frmMain () { /// ... m_oMyObjs = new CMyClass[2]; // how to make the declaration/initialization to be able to pass the listview? } } So, how can I pass the listview (which is initialized correctly) to the class through the constructor when declaring an array? If possible, I'd like to avoid having a get/set property for passing the listview, since it cannot change after the CMyClass object is created and there is no need to access it in any way. I'm not able to figure out the correct syntax (if it is possible) to do this. Thanks for the help, Gyorgy Bozoki You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.