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
  1. Home
  2. General Programming
  3. Visual Basic
  4. Persisting properties of child controls contained in USER CONTOLS

Persisting properties of child controls contained in USER CONTOLS

Scheduled Pinned Locked Moved Visual Basic
questionwinformsperformance
3 Posts 2 Posters 0 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.
  • C Offline
    C Offline
    cnurse
    wrote on last edited by
    #1

    Is there a simple straight forward method of persisting properties of child controls which are contained within user controls? I have a user control which inherits from panel, on that panel is a single text box. The panel user control exposes the text box through a HostedControl property so that the user can set the MultiLine property at designtime. However, that property change is not serialized. It seems that I either have to expose a multiline property on the user control which drives the text box property, or I have to somehow serialize the properties of the text box myself. Any pointers would be appreciated (ooh, provided there to valid memory locations ;-) ). Just to make this abolutely clear. When I add the text box to the Panel user control, if I set the multiline property then all is well, but when I compile my panel/text hybrid control and place it on a form, then all the properties from the panel user control are serialised, but the properties of the text box are not. I view this as pretty obvious behaviour which seems to make sense, but how do I work around it? Nursey

    S 1 Reply Last reply
    0
    • C cnurse

      Is there a simple straight forward method of persisting properties of child controls which are contained within user controls? I have a user control which inherits from panel, on that panel is a single text box. The panel user control exposes the text box through a HostedControl property so that the user can set the MultiLine property at designtime. However, that property change is not serialized. It seems that I either have to expose a multiline property on the user control which drives the text box property, or I have to somehow serialize the properties of the text box myself. Any pointers would be appreciated (ooh, provided there to valid memory locations ;-) ). Just to make this abolutely clear. When I add the text box to the Panel user control, if I set the multiline property then all is well, but when I compile my panel/text hybrid control and place it on a form, then all the properties from the panel user control are serialised, but the properties of the text box are not. I view this as pretty obvious behaviour which seems to make sense, but how do I work around it? Nursey

      S Offline
      S Offline
      steff kamush
      wrote on last edited by
      #2

      at design time on the panel control, set Modifiers property of the textbox to Public or Friend. no need to use anaa property 2 xpose the same. then u'll b able to manipulate the text box anywhere. :rose::rose:

      C 1 Reply Last reply
      0
      • S steff kamush

        at design time on the panel control, set Modifiers property of the textbox to Public or Friend. no need to use anaa property 2 xpose the same. then u'll b able to manipulate the text box anywhere. :rose::rose:

        C Offline
        C Offline
        cnurse
        wrote on last edited by
        #3

        Kamush, Thanks, but that's not the answer. First, I have already exposed the text box as you say by making it public. But two things, firstly when the programmer changes the properties at DESIGN TIME, the windows designer doesn't seem to generate code to effect those property changes at run time. I don't know why. Second, I asked, can my PANEL control expose all the events of the TextBox. My feeling is it can't, without inheriting TextBox, which I can't do because I want a panel that CONTAINS a text box. As I said, this kind of makes sense but its frustrating. or....I still don't understand something, and your answer is right, and my understanding of it is wrong 8-) Thanks. Nursey

        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