473,805 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
+ 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 'EditorAttribut e' takes '1' arguments
(43): No overload for method 'GetType' takes '1' arguments

[Category("Data" ),
EditorAttribute ("System.Window s.Forms.Design. DataMemberListE ditor,System.De sign", 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 3409
Peter <Pe***@discussi ons.microsoft.c om> 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 'EditorAttribut e' takes '1' arguments
(43): No overload for method 'GetType' takes '1' arguments

[Category("Data" ),
EditorAttribute ("System.Window s.Forms.Design. DataMemberListE ditor,
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.D rawing...));
or even
EditorAttribute (typeof(System. Windows...), typeof(System.D rawing...));

--
Jon Skeet - <sk***@pobox.co m>
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.Window s.Forms.Design. DataMemberListE ditor,System.De s
ign", Type.GetType("S ystem.Drawing.D esign.UITypeEdi tor"))]

or add the System.Type namespace to your file.

-Azhagan

"Peter" <Pe***@discussi ons.microsoft.c om> wrote in message
news:2F******** *************** ***********@mic rosoft.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 'EditorAttribut e' takes '1' arguments
(43): No overload for method 'GetType' takes '1' arguments

[Category("Data" ),
EditorAttribute ("System.Window s.Forms.Design. DataMemberListE ditor,System.De s
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.Window s.Forms.Design. DataMemberListE ditor,System.De s
ign", Type.GetType("S ystem.Drawing.D esign.UITypeEdi tor"))]

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.co m>
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.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Azhagan <sp************ ******@hotmail. com> wrote:
You might want to prefix GetType with its namespace Type like so....

[Category("Data" ),

EditorAttribute ("System.Window s.Forms.Design. DataMemberListE ditor,System.De s ign", Type.GetType("S ystem.Drawing.D esign.UITypeEdi tor"))]

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.co m>
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
34288
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 capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
19
2982
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 $ Last-Modified: $Date: 2003/09/22 04:51:49 $ Author: Nicolas Fleury <nidoizo at gmail.com> Status: Draft Type: Standards Track
21
2107
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 string with comma delimited values. For example, if I were to render two text boxes. One with the Value Terry and the Other with the Value 'Burns' I would get the following value Terry,Burns.
3
422
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. I want to get the validatior controls displayed. I ma using ASP server controls. Server Error in '/' Application. ---------------------------------------------------------------------------- ---- Runtime Error Description: An application...
7
3021
by: Shimon Sim | last post by:
I have a custom composite control I have following property
1
1706
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 through the controls on the page using this code, I cant seem to be able to access the Attribute collection. However, if I were to add the tag to a regular TextBox, the Attribute is available. My recursive function looks like this:...
7
1749
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 partial class and the declaration for the label is removed. This is what I expected to happen and I understand why it has happened. The problem I have is that I had added a custom attribute to my label
4
5242
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
1560
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 problem getting that attribute value upon postback. I keep getting a null reference error. I was under the impression that the attribute collection is saved in viewstate. My code to get the attribute value is:
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10609
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
10105
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
9185
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
7646
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
6876
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
5542
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...
1
4323
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
3
3007
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.