|
September 6, 2002 Handling Click Events in a Windows form Tips: September 2002
Yehuda Shiran, Ph.D.
|
|
To associate an event handler with a button, you first need to add the event handler to the button. Let's assume the button is button1 and the event handler is button1_Clicked:
Then, we define the event handler to pop-up an alert box whenever the button is clicked:
The package is ButtonClickPkg and the class is ButtonClickCls. We pop up the Windows form by calling the Application.Run() method:
You should get the following Windows form:
People who read this tip also read these tips: Look for similar tips by subject: |