473,513 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Property's Description and Category do not work


All,

I created a control that have the following property defined:

private bool autoSearch
[
DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")
]
My control is compiled and created fine. But, after adding the control to
my form, I noticed the following problems:

1. The autoSearch property does not show up in the Behavior category.
Instead, it's shown in the Misc. category.
2. The Decription does not show up at all. I can see the autoSearch
property. I can change its value from true to false. But when I clicked on
the autoSearch, its desciption does not show up.

Can someone shed a light on this?

Thanks.
Nov 15 '05 #1
5 6127
100
Hi David,
You should specify attributes before the names they apply to:
[ DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")]
private bool autoSearch

HTH
B\rgds
100


" David N" <dq*****@netiq.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...

All,

I created a control that have the following property defined:

private bool autoSearch
[
DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")
]
My control is compiled and created fine. But, after adding the control to
my form, I noticed the following problems:

1. The autoSearch property does not show up in the Behavior category.
Instead, it's shown in the Misc. category.
2. The Decription does not show up at all. I can see the autoSearch
property. I can change its value from true to false. But when I clicked on the autoSearch, its desciption does not show up.

Can someone shed a light on this?

Thanks.

Nov 15 '05 #2

"100" <10*@100.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi David,
You should specify attributes before the names they apply to:
[ DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")]
private bool autoSearch

HTH
B\rgds
100


" David N" <dq*****@netiq.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...

All,

I created a control that have the following property defined:

private bool autoSearch
[
DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")
]
My control is compiled and created fine. But, after adding the control to my form, I noticed the following problems:

1. The autoSearch property does not show up in the Behavior category.
Instead, it's shown in the Misc. category.
2. The Decription does not show up at all. I can see the autoSearch
property. I can change its value from true to false. But when I
clicked on
the autoSearch, its desciption does not show up.

Can someone shed a light on this?

Thanks.


Nov 15 '05 #3
Sorry for all blank replies. My machine was out of memory and when I press
enter key, some how the message dialog was closed and the message was
sent....

Anh thank you for your reply. I swapped the attributes on top of the
property, but the result is the same. Beside, I don't think the position
makes the different, because I have another property of type string, and the
default value of each property was shown correctly...

"100" <10*@100.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi David,
You should specify attributes before the names they apply to:
[ DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")]
private bool autoSearch

HTH
B\rgds
100


" David N" <dq*****@netiq.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...

All,

I created a control that have the following property defined:

private bool autoSearch
[
DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")
]
My control is compiled and created fine. But, after adding the control to my form, I noticed the following problems:

1. The autoSearch property does not show up in the Behavior category.
Instead, it's shown in the Misc. category.
2. The Decription does not show up at all. I can see the autoSearch
property. I can change its value from true to false. But when I
clicked on
the autoSearch, its desciption does not show up.

Can someone shed a light on this?

Thanks.


Nov 15 '05 #4
My fault!
The attribute declaration does have to be before the property {get/set}
pair. I have to close the solution and reopen it in order to see the
change.

Thanks a lot.

" David N" <dq*****@netiq.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...

All,

I created a control that have the following property defined:

private bool autoSearch
[
DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")
]
My control is compiled and created fine. But, after adding the control to
my form, I noticed the following problems:

1. The autoSearch property does not show up in the Behavior category.
Instead, it's shown in the Misc. category.
2. The Decription does not show up at all. I can see the autoSearch
property. I can change its value from true to false. But when I clicked on the autoSearch, its desciption does not show up.

Can someone shed a light on this?

Thanks.

Nov 15 '05 #5
100
Hi David,
I'm glad that you managed to solve your problem. I just want to point you on
the fact that the position of the attribute declaration *does* matter.
Attributes are applied on the declaration that follows the place where the
attribute is specified. If there is ambiguity or your intent is different
than what is the default target an "atribute target specifier" can be used.

So in your example
private bool autoSearch
[
DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")
]

The attributes will be applied to what follows.

And if your code looks like this:

private bool autoSearch
[
DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")
]
public bool Foo()
{
......
}

The attribute is going to be applied to Foo method rather than autoSearch
member.

The attribute declaration does have to be before the property {get/set}
pair. I don't realy understand what *before {get/set} pair* means.
If you have:

bool Prop
[SomeAttribute]
{
get{}
set{}
}

It is a syntax error and this won't compile.
----------------------------------------
[SomeAttribute]
bool Prop
{
get{}
set{}
}

You apply the attribute to the property.
-----------------------------------------
bool Prop
{

[SomeAttribute]
get{}
set{}
}

I this case by default the attribute will be applied to the *get* method.
You can apply the attribute to the returning value using *return* target
specifier. Anyway, the property Prop itself won't have attribute applied.
-------------------------------------------
bool Prop
{
get{}

[SomeAttribute]
set{}
}
By default you apply the atribute to the *set* method. You can apply the
attribute to the *value* parameter via specifying *param* target. As in the
previous case the property itself won't have attribute applied.

So the position of the attributes *does* matter.

B\rgds
100
" David N" <dq*****@netiq.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...

All,

I created a control that have the following property defined:

private bool autoSearch
[
DefaultValue(typeof(bool),true),
Description("Auto search upon typing"),
Category("Behavior")
]
My control is compiled and created fine. But, after adding the control to my form, I noticed the following problems:

1. The autoSearch property does not show up in the Behavior category.
Instead, it's shown in the Misc. category.
2. The Decription does not show up at all. I can see the autoSearch
property. I can change its value from true to false. But when I
clicked on
the autoSearch, its desciption does not show up.

Can someone shed a light on this?

Thanks.


Nov 15 '05 #6

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

Similar topics

2
6146
by: Todd | last post by:
Hello, I'm curious if anyone knows of a way (if one exists) to tell a form (in Access 2002 VBA) to sort on an unbound column of a combo box on the form. Here's what I want to do: A combo box...
2
3401
by: Steve Teeples | last post by:
Someone introduced me to PropertyGrid last night. It is a great feature for what I need. A question though. I noticed that when I assign a "TextBox" control to a property grid the description on...
2
3009
by: steve bull | last post by:
I have created a label control and got it to appear in the toolbox. The problem I have is that while all the other properties appear for the contro I can't get the Text property to appear at all. I...
9
1511
by: Alphonse Giambrone | last post by:
I have built a simple composite control that consists of a textbox, requiredfieldvalidator and rangevalidator. For properties that are unique to the individual control, I set/get them directly...
0
5546
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control...
2
4829
by: Lance | last post by:
I want to be able to reset a complex property in a PropertyGrid. I know that for properties that are ValueTypes you can include System.ComponentModel.DefaultValue in the declaration of the property....
7
4425
by: Andrea Moro | last post by:
I'm writing my first windows control library. A simple textbox with some numeric facilities. Well, there is a strange thing that happen. I want to add a locked property. As many other property,...
2
2392
by: Rolf Welskes | last post by:
Hello, I have writen a simple aspnet control MyCtrl and want to use it as follows: (c01 may be the tag-prefix): <c01:MyCtrl>this is a simple text</c01:MyCtrl>. The control-code:
2
2010
by: Lespaul36 | last post by:
I have a control that I have made that uses a custom class for storage of some of the information. I want it to display in the VS.Net 2003 property grid in the IDE like the Font property does, so...
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7394
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,...
0
7559
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...
1
7123
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...
0
7542
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...
0
5701
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,...
1
5100
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...
0
1611
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 ...
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.