473,468 Members | 1,294 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Syntax Error on Custom Control Attribute?

Hello,

Thanks for reviewing my question. I am just starting out create a custom
control following the KB example "Create a Data Bound ListView Control". I
am receiving a syntax error on the following:

(43): No overload for method 'EditorAttribute' takes '1' arguments
(43): No overload for method 'GetType' takes '1' arguments

[Category("Data"),
EditorAttribute("System.Windows.Forms.Design.DataM emberListEditor,System.Design", GetType("System.Drawing.Design.UITypeEditor"))] // << SYNTAX ERROR
public string DataMember
{
get
{
return mDataMember;
}
set
{
mDataMember = value;
DataBind();
}
}

From the article, I need the attributes in order for VS.NET invoke a
specific object to manage the enhanced display in the Properties window.

Any ideas what causing the syntax error?

Many Thanks
Peter

Nov 16 '05 #1
4 3386
Peter <Pe***@discussions.microsoft.com> wrote:
Thanks for reviewing my question. I am just starting out create a custom
control following the KB example "Create a Data Bound ListView Control". I
am receiving a syntax error on the following:

(43): No overload for method 'EditorAttribute' takes '1' arguments
(43): No overload for method 'GetType' takes '1' arguments

[Category("Data"),
EditorAttribute("System.Windows.Forms.Design.DataM emberListEditor,
System.Design", GetType("System.Drawing.Design.UITypeEditor"))]
// << SYNTAX ERROR
public string DataMember
{
get
{
return mDataMember;
}
set
{
mDataMember = value;
DataBind();
}
}

From the article, I need the attributes in order for VS.NET invoke a
specific object to manage the enhanced display in the Properties window.

Any ideas what causing the syntax error?


The first is because of the second. You actually meant Type.GetType,
but you can't use that in an attribute declaration. Instead, you've got
to either use typeof, or just give the name as another parameter:

EditorAttribute ("...", "System.Drawing....")
or
EditorAttribute ("...", typeof(System.Drawing...));
or even
EditorAttribute (typeof(System.Windows...), typeof(System.Drawing...));

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
You might want to prefix GetType with its namespace Type like so....

[Category("Data"),

EditorAttribute("System.Windows.Forms.Design.DataM emberListEditor,System.Des
ign", Type.GetType("System.Drawing.Design.UITypeEditor") )]

or add the System.Type namespace to your file.

-Azhagan

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:2F**********************************@microsof t.com...
Hello,

Thanks for reviewing my question. I am just starting out create a custom
control following the KB example "Create a Data Bound ListView Control". I am receiving a syntax error on the following:

(43): No overload for method 'EditorAttribute' takes '1' arguments
(43): No overload for method 'GetType' takes '1' arguments

[Category("Data"),
EditorAttribute("System.Windows.Forms.Design.DataM emberListEditor,System.Des
ign", GetType("System.Drawing.Design.UITypeEditor"))] // << SYNTAX ERROR public string DataMember
{
get
{
return mDataMember;
}
set
{
mDataMember = value;
DataBind();
}
}

From the article, I need the attributes in order for VS.NET invoke a
specific object to manage the enhanced display in the Properties window.

Any ideas what causing the syntax error?

Many Thanks
Peter

Nov 16 '05 #3
Azhagan <sp******************@hotmail.com> wrote:
You might want to prefix GetType with its namespace Type like so....

[Category("Data"),

EditorAttribute("System.Windows.Forms.Design.DataM emberListEditor,System.Des
ign", Type.GetType("System.Drawing.Design.UITypeEditor") )]

or add the System.Type namespace to your file.


There's no namespace System.Type. Type is the *classname*. Not that you
can call methods in attribute declarations.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
Thanks, Jon. I stand corrected... there is no namespace called Type.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Azhagan <sp******************@hotmail.com> wrote:
You might want to prefix GetType with its namespace Type like so....

[Category("Data"),

EditorAttribute("System.Windows.Forms.Design.DataM emberListEditor,System.Des ign", Type.GetType("System.Drawing.Design.UITypeEditor") )]

or add the System.Type namespace to your file.


There's no namespace System.Type. Type is the *classname*. Not that you
can call methods in attribute declarations.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #5

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
19
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $...
21
by: One Handed Man \( OHM - Terry Burns \) | last post by:
When using a custom control. In order to check and see if values have changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a...
3
by: abcd | last post by:
I get following error. I have 2 simple text boxes and requiresValidator control attached to them. When run on development machine is works when deployed on production server I get following errors....
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
1
by: Sanjay Pais | last post by:
I built a custom control for all the basic web.ui.controls like textbox, label, checkbox etc etc. I added my custom attribute called ApplySecurity to the html in the page. However, when I cycle...
7
by: Julian Jelfs | last post by:
Hi, I had an aspx pag in .Net 1.1 with a label on it. As such I had a code behind page with a declaration for that label. When I convert to Asp.Net 2.0 the code behind is converted to a...
4
by: news.citenet.net | last post by:
I keep getting the following error message after my web site running 2 or 3 days I share one folder with about 200 domain names Any one can help? ...
2
by: mirlisa | last post by:
I'm using an HtmlSelect (runat=sever). I add the items programmatically and I also add a custom attribute to each listitem because I need to track an additional field value. I'm having a...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
1
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
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,...
0
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...
0
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...
0
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 ...

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.