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

EventHandler assignment

private void MainForm_Load(object sender, EventArgs e)

{

tsHelpDropDownButton.MouseLeave += new
EventHandler(this.MenuDropDownButton_MouseLeave);

}

private void MenuDropDownButton_MouseLeave(object sender, EventArgs e)

{

(ToolStripDropDownButton)sender.HideDropDown(); // ERROR

}

I got a compilation error:

"Only assignment, call, increment, decrement, and new object expressions can
be used as a statement"

What did I do incorrectly?
Oct 12 '06 #1
1 1688
Hi,

You are missing a set of () :

( (ToolStripDropDownButton)sender ) .HideDropDown();

--
Ignacio Machin
machin AT laceupsolutions.com
"Alan T" <al*************@yahoo.com.auwrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl...
private void MainForm_Load(object sender, EventArgs e)

{

tsHelpDropDownButton.MouseLeave += new
EventHandler(this.MenuDropDownButton_MouseLeave);

}

private void MenuDropDownButton_MouseLeave(object sender, EventArgs e)

{

(ToolStripDropDownButton)sender.HideDropDown(); // ERROR

}

I got a compilation error:

"Only assignment, call, increment, decrement, and new object expressions
can be used as a statement"

What did I do incorrectly?


Oct 12 '06 #2

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

Similar topics

2
by: Sandor Heese | last post by:
Question, When using BeginInvoke (on a From to marshal to the UI thread) with the EventHandler delegate I see some strange behaviour. The problem is that I call the UpdateTextBox method with a...
3
by: Remco | last post by:
Hello, Serverside I'm generating a html page. There are different controls for which I want to create an eventhandler manually. Like: document.forms.TextBox1.onchange = EventHandler;...
12
by: aplaxas | last post by:
Hi! "CDemo.Call" eventHandler is added to "button3.click" Event when both button1 and button2 are clicked. However, I want to add "cd.Call" only one time even though I clicked both button1 and...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
9
by: Christopher Weaver | last post by:
Can anyone tell me how I could iterate through a collection of controls on a form while assigning their event handlers to another identical collection of controls on the same form. So far,...
13
by: jac | last post by:
Hae, I have a windows form with a ComboBox an other things. On that combobox I have an eventhandler on de selectedindexchanged. But somewhere in my code want to do excecute the same code that...
2
by: mawi | last post by:
Hi there, When removing page children controls created dynamically not in last-to-first order, the close button of the last control looses its event wiring, even though the handler is rewired...
2
by: Phil | last post by:
Is it better to assign eventhandlers in codebehind: this.Button1.Click += new EventHandler(Button1_Click); or delcaritive: <asp:button id="Button1" runat="server" onclick="Button1_Click"...
2
cornfed
by: cornfed | last post by:
I've got a class to make Templates for different repeaters in my page. in one of these repeaters a linkbutton is needed. This LinkButton needs an event that is in a .cs file somewhere else in the...
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: 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
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.