Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate a Property of a Control located inside of a UserControl
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2881409/text-property-in-a-usercontrol-in-c-sharp">Text property in a UserControl in C#</a> </p> </blockquote> <p>I'm creating a UserControl that I would like to be available to another development group as a sort of "black box" widget. </p> <p>As such, I would like all of the major properties to be accessible and editable from the 'Properties' window during design time. </p> <p>Each of my properties is tagged like this:</p> <pre><code>&lt;Category("Foo"), _ Description("The Foo of this Fubar"), _ Browsable(True)&gt; _ Property Example() As Baz </code></pre> <p>And is successfully displayed in the 'Properties' window. I have one property, however, that is overriding the 'Text' property of UserControl so that the other developers should be able to edit the Text of my control, and have it edit the displayed Text of a label on the UserControl. The code looks like this:</p> <pre><code> &lt;Category("Appearance"), _ Description("Text to be displayed on StatusWidget"), _ Browsable(True)&gt; _ Overrides Property Text() As String Get Return sText End Get Set(ByVal Value As String) sText = Value TextBlock.Text = sText End Set End Property </code></pre> <p>This works fine when called in the VB code of an external project like this:</p> <pre><code>StatusWidget1.Text = "My Goddang Text" </code></pre> <p>But does not automatically update when a string is typed into the 'Text' field of the 'Properties' window.</p> <p>Attempts to correct this with a call like this <code>Me.Label1.Text = Me.Text</code> in the "InitializeComponent()" method are unsuccessful.</p> <p>So finally, my question: Is there any way to update the properties of the Controls that are present on a UserControl from the 'Properties' window, such that they are available immediately during run?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload