cnordvik Posted May 5, 2003 Posted May 5, 2003 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> Quote
*Gurus* divil Posted May 5, 2003 *Gurus* Posted May 5, 2003 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 Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
cnordvik Posted May 6, 2003 Author Posted May 6, 2003 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.