Results 1 to 5 of 5

Thread: Properties not exposed at design time

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Properties not exposed at design time

    I'm loading up at usercontrol on my webform like so:

    VB Code:
    1. Dim aSkin as Control = nothing
    2. aSkin = LoadControl(("/Themes/default/Skins/default.ascx"))

    I have defined a public property in this usercontrol, default.ascx, called bgColor.

    My problem is that once i've loaded this control, the properties of aSkin are just the default properties of a control. The public property that i've defined is not exposed during design time, it is only exposed at run time.

    I want to access the value of this bgColor property at design time. How would I do this?

    Any takers?

    Patch

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Properties not exposed at design time

    I don't have any references open right now, but I think you need to set the Browsable attribute for that property to true. Something like

    <Browsable() = True>Public Property bgColor() As String

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Properties not exposed at design time

    A few threads below yours, take a look:

    http://www.vbforums.com/showthread.php?t=352250

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Re: Properties not exposed at design time

    Thanks

    Tried that now, but doesnt seem to work.

    I don't know how the designer would be able to recognise which control i'm loading exactly with the loadcontrol() method. It could be any control in my solution, so it simply puts the default properties of a control in the property browser. The difference between this situation and the one in the other post, is that he is referencing a specific control, whereas mine can be any control.

  5. #5
    Fanatic Member MetalKid's Avatar
    Join Date
    Aug 2005
    Location
    Green Bay, Wisconsin
    Posts
    534

    Re: Properties not exposed at design time

    You could alwawys just do:

    aSkin = Ctype(LoadControl(("/Themes/default/Skins/default.ascx")), YourControlType)

    Then you should be able to do .bgcolor at the end.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width