I created a custom control and added a label property for it, so at design time we can choose a label And I can control that, basically I want that if a label is assigned to that control then its text should be changed below and its text should be changed to bold font, so this is the code: < / P>
Private label assignments Force; Public label assign label (get {return assignedLabel;} set {assignedLabel = value; AssignedLabel.Text = @ "*" + unusual label. Text; AssignedLabel.Font = new font (AssignedLabel.Font, FontStyle.Bold); AssignedLabel.Refresh ();}}
The problem is that the font of that assigned label is correctly changing to bold font based on the code, but its text Why is this not happening? How can I fix this problem?
It really looks like you should find databanding. For example, if you have two controls, you can call a text box (text box 1) and a label (label 1) It is perfect for handling the internal functions of updating the labels on the basis of any other control.
The following line of code whenever you want to bind them: Label1.DataBindings.Add ("Text", textBox1, "Text");
This text 1's text The "text" of the label "property" binds the "text" property. You can use any object here The "right" way to do this is to create the underlying data source in which the current state of many variables occurs, and bind all the controls at that data source. But this type of code is going away soon.
Comments
Post a Comment