Creating Buttons

Every dialog box that Windows displays has at least one button on it. Buttons enable a user to invoke a function with a click of the mouse. Create a new project named Button Example, change the name of the default form to fclsButtonExample, set the form's Text property to Button Example, and update the entry point Main() to reference fclsButtonExample instead of Form1. Next, add a new button to the form by double-clicking the Button item in the toolbox. Set the button's properties as follows:

Property Value
Name btnClose
Location 104,90
Text Close

Add a new text box to the form and set its properties as follows:

Property Value
Name txtTest
Location 92,40
TabIndex 0
Text (make blank)

You're probably starting to see a pattern ...

Get Sams Teach Yourself C#™ 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.