Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a custom control with an arraylist containing Panels. The array is working great in design mode, but when I run the application then the list is set to null.

 

Is there any difference between an arraylist and a string or int when it comes to persisting the values?

 

 

My panel class

<cs>

[serializable()]

public class MyTabbedPage : Panel

 

{

public VizTabbedPage()

{

//

// TODO: Add constructor logic here

//

 

}

</cs>

 

And my control:

 

<cs>

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]

[Category("Test"),Editor(typeof(VizTabbedPageEditor),typeof(UITypeEditor))]

public System.Collections.ArrayList TabPages

{

get

{

return tabPages;

}

set

{

tabPages = value;

if(tabPages != null)

{

updateTabPages();

}

 

}

}

</cs>

  • *Gurus*
Posted

Why are you using an ArrayList? I recommend you make your own strongly-typed collection by inheriting from CollectionBase. You'll also need to implement a typeconverter for tabpages.

 

I've got sample code posted at http://www.divil.co.uk/net/articles/designers/collectioncontrols.asp

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

Thanks a lot! I'm from a Java background and not used to GUI programming. Been doing too much web programming so I really did not see any reason to not use Arraylist, but now I do!

 

-Christer

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...