Change label's Name when Text assigned at design time programmatically?



I have my own control that inherits from Label. When I drop it on a
form, it defaults the object Name to MyLabel1 and the Text to MyLabel1.
I'd like the control to automatically rename itself if it detects, at
design time, the Text property changes; e.g.

private sub MyLabel_TextChanged.... handles Me.TextChanged
if me.Name.StartsWith( "MyLabel") then
me.Name = Me.Text (minus spaces)
end if
end sub

Is this possible?

.



Relevant Pages

  • Default Text value for Custom Control
    ... I'm trying to create a compisite Windows custom control. ... When I create Inherited control with the name, ... it that property, but I do not know how to set it to MyLabel1, MyLabel2 etc. ...
    (microsoft.public.dotnet.general)
  • Re: how to have a checkbox change color and text of a label control?
    ... So could you make the label control box change color instead of the font? ... states "Private Sub Form_Current is highlighted yellow ... Name the checkbox and the label with similar names. ...
    (microsoft.public.access.forms)
  • Re: Reversing changes made by mousemove event
    ... I have a label control so this is how I ... It doesn't work with the control array of labels. ... Private Sub Label2_DragDrop(Index As Integer, Source As Control, X As ... Label2.Drag vbEndDrag ...
    (microsoft.public.vb.general.discussion)
  • Re: Reversing changes made by mousemove event
    ... like you are saying that your modified code doesn't work with the control ... Private Sub Label2_DragDrop(Index As Integer, Source As Control, X As ... Label2.Drag vbEndDrag ... to another label without going over the image control. ...
    (microsoft.public.vb.general.discussion)
  • Re: re-use of code in a module ...
    ... First thing you need to know is that a label which is attached to a control ... Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, X As ...
    (microsoft.public.access.formscoding)