Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Custom Control problem

Custom Control problem

Scheduled Pinned Locked Moved C#
graphicsdesigndockerhelpquestion
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spif2001
    wrote on last edited by
    #1

    I have made a Custom Control and I'm having troubles in design time - I have omitted the Dispose method to the ABox in the code below. Using the following code in design time (adding an ABox to a Form), i can change the MyComp.MyText property in the property editor and the Text property on my ABox will change. But I can't change the MyComp.MyList property and make it change the ABox' Items values. It works in RunTime but not in design time. How come? Any and all ideas would be very welcome. spif2001 using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace AgroTest { public class ABox : System.Windows.Forms.ComboBox { private System.ComponentModel.Container components = null; private MyComp myComponent; public ABox() { InitializeComponent(); this.myComponent = new MyComp(this); } [Category("AgroTest"), System.ComponentModel.DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public MyComp MyComponent { get { return this.myComponent; } } private void InitializeComponent() { components = new System.ComponentModel.Container(); } } } using System; using System.ComponentModel; using System.Windows.Forms; using System.Collections.Specialized; namespace AgroTest { [TypeConverterAttribute(typeof(ExpandableObjectConverter))] public class MyComp { private ABox owner; private StringCollection myList = new StringCollection(); private string myText = "!!"; internal MyComp(ABox owner) { this.owner = owner; } [Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor)), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), DefaultValue(false)] public StringCollection MyList { get{return this.myList;} set { try { this.owner.Items.Clear(); foreach(string s in value) { this.owner.Items.Add(s + "!!"); } this.owner.Invalidate(); this.myList = value; } catch(Exception){} } } [DesignerSeri

    M 1 Reply Last reply
    0
    • S spif2001

      I have made a Custom Control and I'm having troubles in design time - I have omitted the Dispose method to the ABox in the code below. Using the following code in design time (adding an ABox to a Form), i can change the MyComp.MyText property in the property editor and the Text property on my ABox will change. But I can't change the MyComp.MyList property and make it change the ABox' Items values. It works in RunTime but not in design time. How come? Any and all ideas would be very welcome. spif2001 using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace AgroTest { public class ABox : System.Windows.Forms.ComboBox { private System.ComponentModel.Container components = null; private MyComp myComponent; public ABox() { InitializeComponent(); this.myComponent = new MyComp(this); } [Category("AgroTest"), System.ComponentModel.DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public MyComp MyComponent { get { return this.myComponent; } } private void InitializeComponent() { components = new System.ComponentModel.Container(); } } } using System; using System.ComponentModel; using System.Windows.Forms; using System.Collections.Specialized; namespace AgroTest { [TypeConverterAttribute(typeof(ExpandableObjectConverter))] public class MyComp { private ABox owner; private StringCollection myList = new StringCollection(); private string myText = "!!"; internal MyComp(ABox owner) { this.owner = owner; } [Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor)), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), DefaultValue(false)] public StringCollection MyList { get{return this.myList;} set { try { this.owner.Items.Clear(); foreach(string s in value) { this.owner.Items.Add(s + "!!"); } this.owner.Invalidate(); this.myList = value; } catch(Exception){} } } [DesignerSeri

      M Offline
      M Offline
      manivannan p
      wrote on last edited by
      #2

      Hi, Try calling the InValidate() method, even after you set the value in the property.ie, In "public StringCollection MyList" and "public string MyText", in the set block , call Invalidate after u set the value to MyText. Try this and let me know... Regards, Manivannan

      S 1 Reply Last reply
      0
      • M manivannan p

        Hi, Try calling the InValidate() method, even after you set the value in the property.ie, In "public StringCollection MyList" and "public string MyText", in the set block , call Invalidate after u set the value to MyText. Try this and let me know... Regards, Manivannan

        S Offline
        S Offline
        spif2001
        wrote on last edited by
        #3

        Sadly it had no effect - thanks though :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups