473,387 Members | 1,532 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,387 software developers and data experts.

C# Event raiser VS2005

Hi.

Whenever I try to do this:

myTextBox.TextChanged += new
System.IO.FileSystemEventHandler(textChanged(myRow .Cells[1],
myTextBox.Text));

I get the error:
"Method name expected"

Can any one help me with this one?

Thanks

Ricardo Carvalho

Oct 16 '06 #1
1 1397
In normal (1.1) usage, you specify a *method* to invoke (via the delegate
signature), not specific *code* to invoke. And that is almost certainly the
wrong signature anyway. Two options:

a: create an explicit method to handle it:

myTextBox.TextChanged+=new EventHandler(myTextBox_TextChanged);
// blah
// note: name doesn't matter
void myTextBox_TextChanged(object sender, EventArgs e)
{
textChanged(myRow.Cells[1], myTextBox.Text);
}

b: (2.0) use an anonymous (inline) method:
myTextBox.TextChanged += delegate {
textChanged(myRow.Cells[1], myTextBox.Text);
};

Marc
Oct 16 '06 #2

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

Similar topics

0
by: JohnK | last post by:
I have an event raiser, I have instantiated 20,000 objects, each which "listen" for the event (call it event 1)... each of those 20K objects also raise another event (event 2).... and for each of...
10
by: localhost | last post by:
I have a static, thread-safe class with a DataSet as a property. When the class is instanced into an object, some callers add rows to a DataTable in the DataSet. Other callers read the DataSet. ...
4
by: rawCoder | last post by:
Hi all, How Can You Raise Events Asynchronously ? Now for the details ... I want to do inter modular communication using events in such a way that the contributing modules need not...
3
by: Edward Diener | last post by:
According to the CLS specification, the accessibility of the methods for adding, removing, and raising an event must be identical. There appear to be a few problems with this: 1) According to...
2
by: Amelyan | last post by:
I *finally* narrowed down my problem to my custom web control. If I hookup event inside dynamically created custom web control, it doesn't get fired. However, event gets fired for any other...
0
by: Dan Sikorsky | last post by:
I'm using a stored procedure as the select command for an SqlDataSource tied to a GridView. I've verified the sp returns rows in the Management Studio as well as in VS2005 when I Configure the...
2
by: Brett Wickard | last post by:
How do I add an event to an object (in this case a form) that is viewable in the GUI of VS2005? i.e. if I add the following to a form: public delegate void TestDelegate(int Test); public...
7
by: Don | last post by:
Getting errors after following the MSDN article on using VB.NET (and VS2005) for "Implementing a Managed OnSave Event Sink" for Exchange Server 2007. Not sure, but part of the problem may be that...
2
by: hharry | last post by:
Hello All, In VS 2003, I was able to add event handlers in the InitializeComponent function. In VS 2005, I can no longer see the auto- generated code. I tried to add the event handler for a...
3
by: =?Utf-8?B?d2Vic211cmY=?= | last post by:
dear newsgroup member, I want to access a label in a form (form1.cs) from a class file (periodicUpload.cs). The label in form1.cs is a status Indicator. PeriodicUpload.cs is a timer class file....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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
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,...

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.