473,715 Members | 6,082 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 2218
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
1461
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
4781
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
5303
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
1920
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
5474
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
2103
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
1902
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
1795
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
8718
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9343
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9198
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...
0
9047
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
7973
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
6646
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
5967
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4477
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
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.