CrookDawg Posted February 2, 2005 Posted February 2, 2005 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 Quote
CrookDawg Posted February 7, 2005 Author Posted February 7, 2005 anybody had this problem before? Quote
PiggyBank1974 Posted February 8, 2005 Posted February 8, 2005 are you using mybase.text or not??? I have found the same problem, and reverted to using my own text property. the pig.. Quote
CrookDawg Posted February 8, 2005 Author Posted February 8, 2005 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 Quote
Administrators PlausiblyDamp Posted February 8, 2005 Administrators Posted February 8, 2005 Any chance you could post the relevant code? It makes it a lot easier for people to help if they don't have to imagine the source.... Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
CrookDawg Posted February 9, 2005 Author Posted February 9, 2005 (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 helpControlEx.zip Edited February 9, 2005 by PlausiblyDamp Quote
Administrators PlausiblyDamp Posted February 9, 2005 Administrators Posted February 9, 2005 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
CrookDawg Posted February 9, 2005 Author Posted February 9, 2005 it worked!! (not that i doubted you) ill have to read up on DesignerSerializationVisibility when i get the time. thanks for your help (again) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.