Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i made a custom button control just for fun but when i start the test program, the text i entered in the designer disappears from the button. in the designer, it works. i found out that for some reason vs.net is not adding a me.button.text property under the code properties of my control. the text property is declared overrides in my control. if i manually add the control via code in the load procedure and add text to it there, it works no problem. anyone know what how to convince the designer to add my property when i change it at design time?

 

thanks for your help

-matt

Posted
are you using mybase.text or not???

 

I have found the same problem, and reverted to using my own text property.

 

the pig..

 

 

i don't belive so. i have the property declared shadows (otherwise it doesn't accept the declaration) i have had this work on some of my other controls. ill try to see what is different about this one. thanks

Posted (edited)
here is the project. the problem is with the control ButtonEx. the rest are just unfinished controls that i was experimenting with as i am sorta new to programming. thanks for your help

ControlEx.zip

Edited by PlausiblyDamp
  • Administrators
Posted

I would remove your local _text variable and use the base class' version and then change the property to

    _
   Public Overrides Property Text() As String
       Get
           Return MyBase.Text
       End Get
       Set(ByVal Value As String)
           MyBase.Text = Value
           Invalidate()
       End Set
   End Property 'Text

The DefaultValue("") attribute is optional but the DesignerSerializationVisibility attribute is the key to the problem here.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...