473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Method Name Expected Error

I'm getting a Method Name Expected error when I try to compile.

The error happens here:

imgImage.Click += new ImageClickEventHandler(updateColours("X"));
Can someone tell me what I'm doing wrong?

Thanks,

JJ
Nov 16 '05 #1
3 8932
>Can someone tell me what I'm doing wrong?

You have a method call in the delegate constructor call, where a
simple method name is expected. Have you tried

imgImage.Click += new ImageClickEventHandler(updateColours);

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2
What if I want to pass an argument with that method?

JJ
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uf*************@TK2MSFTNGP14.phx.gbl...
Can someone tell me what I'm doing wrong?


You have a method call in the delegate constructor call, where a
simple method name is expected. Have you tried

imgImage.Click += new ImageClickEventHandler(updateColours);

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #3
Jeff Johnson <je**********@hotmail.com> wrote:
What if I want to pass an argument with that method?


The arguments will be passed by whatever invokes the delegate. If you
want to give extra information, you have to encapuslate that extra
information somewhere. See the first example in
http://www.yoda.arachsys.com/csharp/...rameters.shtml
for an example of this.

--
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

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

Similar topics

1
by: Andrew Edwards | last post by:
Could someone please tell me what I'm doing wrong? The compiler barks at me whenever I throw (bad_alloc). If I remove this the code compiles just fine. template < class DT, class KF > class...
6
by: Zenon | last post by:
Folks, I cannot figure out why I am getting an error: Error E2303 EngineX.hpp 19: Type name expected. Here is my code. Can you please help? #ifndef EngineX__hpp #define EngineX__hpp ...
1
by: TAM | last post by:
Hi, I have a simple JavaScript code that ensures that all the form fields are filled and there is also a function that checks if the email is a valid address. For some reason IE is giving...
4
by: Vishu | last post by:
I m getting this error "Mehtod name expected" in my following code. protected int GetSelectedIndex(string CID) { DataTable dt = ddlDataSet.Tables; for(int iLoop = 0; iLoop <= dt.Rows.Count - 1;...
4
by: Kiyomi | last post by:
Hello, I am trying to replace my alert message box with a popup page. In my page behind,
1
by: finizaini | last post by:
I'm receiving an "Object Expected" Error (Line:309, Char:0). I'm confused as to what is happening.Also, I can't run this code using other browser such as Fire Fox. Thispage only can view using IE....
3
by: =?Utf-8?B?YW5kcmV3?= | last post by:
I have a web application demo page and a web service. On my machine everything works great. In our test environment the web service is working fine... when I point the demo page on my machine...
2
by: tridirk | last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong? Line: Char: Error: Object expected Code:0 the site is My SMF Forum
1
by: Alex Dransfield | last post by:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace FindFactors { class Program {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...

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.