Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

What will happen when we press a button?

Edit:
I mean if we press a button how an event occur ? What is happening internally ? How it generates an event ?
Posted
Updated 7-Oct-11 1:05am
v3
Comments
Sander Rossel 7-Oct-11 7:06am    
Updated your question. Pasted your comment in there for clarity.
Silju MC 7-Oct-11 7:14am    
Thanks for the updation....

The Button is a class which contains various events one of which is the Click event. It also has properties which keep values about it's location, both on the form and on the screen. It also has a method which communicates with Windows, and keeps track of the whereabouts of the mouse, and what state the mouse is in. If the mouse is clicked and the mouse pointer is within the bounds of the control, it tells all other objects/classes that have registered for that event to do what they have been told to do. There is a good tutorial on MSDN about events and eventhandling[^].

Hope this helps.
 
Share this answer
 
Comments
Silju MC 7-Oct-11 8:37am    
ya thats fine. my 5
[no name] 7-Oct-11 10:29am    
Good answer. +5
C#
protected void butonClick(object sender,EventArgs e)
{
   MessageBox.Show("What ever you want !");
 
}
 
Share this answer
 
Comments
Silju MC 7-Oct-11 7:00am    
I mean if we press a button how an event occur ? What is happening internally ? How it generates an event ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900