473,883 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inherited properties in userControl

Joe
OK, so i searched this forum, and it seems like my question has come close to
being answered a dozen times, but never fully...
I have a very simple control that inherits from UserControl. It has no
child controls, just properties and custom drawing. I would like one of
these properties to be 'Text'.
So i setup a private _Text field (base.Text not accessible) and public
String Text property. I have tried using both 'override' and 'new' keywords,
but the results appear to be the same, which is limited access to the Text
property when trying to use the control on a Designer form. The best I can
do is to get the property to show up in the IDE property window, but nothing
else. I can set the Text in the property window, but the Form Designer does
not generate the corresponding code to set the property, so when I run my
project, the Text i set has reverted back to the default text. I can
manually go into the designer code and put the line in myself, run the
project, and everything works as expected. If i do the same, but then go
back to the designer and change the Text in the property window, the code i
just inserted gets erased.
I'm assuming this an inheritance issue, since all my other non-inherited
properties exhibit the expected behavior. This seems like it should be an
easy answer, but it's got me frustrated. Is there another issue here, like
the fact that the text property comes from 3 levels of inheritance down? I
know I could probably avoid all this by just changing the property name, but
I'd like to stick with the commonality theme if at all possible.
Thanks in advance,
Joe
Nov 17 '05 #1
2 2221
Try using a declaration as shown at the link below.
http://groups-beta.google.com/group/...cb94cfe5?hl=en

--
Tim Wilson
..Net Compact Framework MVP

"Joe" <joe.klecha-AT-digeratisolutio ns-DOT-net> wrote in message
news:42******** *************** ***********@mic rosoft.com...
OK, so i searched this forum, and it seems like my question has come close to being answered a dozen times, but never fully...
I have a very simple control that inherits from UserControl. It has no
child controls, just properties and custom drawing. I would like one of
these properties to be 'Text'.
So i setup a private _Text field (base.Text not accessible) and public
String Text property. I have tried using both 'override' and 'new' keywords, but the results appear to be the same, which is limited access to the Text
property when trying to use the control on a Designer form. The best I can do is to get the property to show up in the IDE property window, but nothing else. I can set the Text in the property window, but the Form Designer does not generate the corresponding code to set the property, so when I run my
project, the Text i set has reverted back to the default text. I can
manually go into the designer code and put the line in myself, run the
project, and everything works as expected. If i do the same, but then go
back to the designer and change the Text in the property window, the code i just inserted gets erased.
I'm assuming this an inheritance issue, since all my other non-inherited
properties exhibit the expected behavior. This seems like it should be an
easy answer, but it's got me frustrated. Is there another issue here, like the fact that the text property comes from 3 levels of inheritance down? I know I could probably avoid all this by just changing the property name, but I'd like to stick with the commonality theme if at all possible.
Thanks in advance,
Joe

Nov 17 '05 #2
Joe
I had previously tried setting Browsable and EditorBrowsable ..
DesignerSeriali zationVisibilit y and Bindable must have did the trick, cause
it works now. Thanks Tom

"Tim Wilson" wrote:
Try using a declaration as shown at the link below.
http://groups-beta.google.com/group/...cb94cfe5?hl=en

--
Tim Wilson
..Net Compact Framework MVP

"Joe" <joe.klecha-AT-digeratisolutio ns-DOT-net> wrote in message
news:42******** *************** ***********@mic rosoft.com...
OK, so i searched this forum, and it seems like my question has come close

to
being answered a dozen times, but never fully...
I have a very simple control that inherits from UserControl. It has no
child controls, just properties and custom drawing. I would like one of
these properties to be 'Text'.
So i setup a private _Text field (base.Text not accessible) and public
String Text property. I have tried using both 'override' and 'new'

keywords,
but the results appear to be the same, which is limited access to the Text
property when trying to use the control on a Designer form. The best I

can
do is to get the property to show up in the IDE property window, but

nothing
else. I can set the Text in the property window, but the Form Designer

does
not generate the corresponding code to set the property, so when I run my
project, the Text i set has reverted back to the default text. I can
manually go into the designer code and put the line in myself, run the
project, and everything works as expected. If i do the same, but then go
back to the designer and change the Text in the property window, the code

i
just inserted gets erased.
I'm assuming this an inheritance issue, since all my other non-inherited
properties exhibit the expected behavior. This seems like it should be an
easy answer, but it's got me frustrated. Is there another issue here,

like
the fact that the text property comes from 3 levels of inheritance down?

I
know I could probably avoid all this by just changing the property name,

but
I'd like to stick with the commonality theme if at all possible.
Thanks in advance,
Joe


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1469
by: mrVithan | last post by:
I create a user control object and show its properties through a propertygrid object in my application. It is sure that there are 100 hundred of properties inherited from System.Windows.Forms.UserControl and they are all showed on the propertygrid. Is there a way i can hide all these inherited properties and show only my user control's properties ?
2
4789
by: adbarnet | last post by:
Hi, I'm a C++ developer coming fresh to c# for GUI development. For the project I'm working on, I need a specialised control (a treeview derivative) which would be very useful in other applications I might need to write. Back in my day ;-) I would have written a user control for use from within VB, which I could still do, however - I also have the (more appealing from my perspective) option of deriving a control from the .NET base...
11
5317
by: Crirus | last post by:
I need to derive the Windows.Forms.Control 2 times so I design a class like this Public Class BMControl Inherits System.Windows.Forms.UserControl Public Class MapControl Inherits BMControl
1
272
by: Juan Pedro Gonzalez | last post by:
Hi, I've develpped a reusable UserControl. The only headache it's giving me is how to hide the inherited properties such as AutoScroll, DockPadding, etc... wich could cause some visual Anoyances on my control.I've tried <System.ComponentModel.Browsable(False), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableS tate.Never), System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.
1
1926
by: elziko | last post by:
I have sucessfully created a control that inherits from a UserControl. Now I want to extend this by adding extra controls but if I try and drop a control onto the form then I just get the "No" cursor and I'm not able to drop the control onto the designer. I can add controls in the InitializeComponent procedure of my inherited UserControl and they do appear in the designer at design time but am unable to edit any of it properties.
3
5486
by: Wayne Brantley | last post by:
VS2005 RTM Create a web user control to use as a base class for other web user controls. Now, create a new web user control, change the class it inherits from to your base class and compile. (You must have a <% Register %> so it will see it) You will get TWO warnings per class like:
2
2108
by: Steven Nagy | last post by:
Hi all, How would I go about hiding an inherited property? In particular, I want to hide the 'BackColor' property of the UserControl class. I will then implement my own back color related properties and collections. I can do all the latter, but I don't want to build this nice designable properties and have this big ugly 'BackColor' property available to the user of my components, which will need to be set to Transparent all the
1
1916
by: ben m | last post by:
Hi all - we've recently switched up to 2005, and I'm having trouble getting the hang of some things, among them, creating a control for the project. Currently, we use a combination of controls on a TabControl - mainly a grid on one tab, and a checkboxlist on the other, that coordinate back and forth, so (un)checking a box will hide or show a column on the grid. In addition, I would like the flexibility of adding a DataSource at design time...
5
1802
by: Martin | last post by:
Hi all, I have made a usercontrol and I want to prevent the ContextMenuStrip property from being available, how can I do this? I have tried stuff like Protected Shadows ContextMenuStrip as Object But I can always still see the property in the designer, can anyone help me out with this?
0
10745
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10848
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10417
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9575
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7972
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5798
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5992
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.