Building an Event Example Project

You're now going to create a very simple project in which you'll use the event procedures of a text box. Specifically, you're going to write code to display a message when a user clicks a mouse button on the text box, and you'll write code to clear the text box when the user releases the button. You'll be using the e parameter to determine which button the user has clicked.

Creating the User Interface

Create a new Windows application titled Events Example. Change the form's Text property to Events Example.

Next, add a text box to the form by double-clicking the TextBox tool in the toolbox. Set its properties as follows:

PropertyValue
NametxtEvents
Location48,120
Size193, 20
TextClick Me!

The only other control you ...

Get Sams Teach Yourself Microsoft® Visual C#™ .NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.