To clarify, Text property is your front-facing button text, and Name is your code reference name for the button.ģ Your physical button should now reflect the name you gave it.Ĥ Double click the “Exit” button on the GUI and this will switch to code view and automatically create a class for your exit button. This will be the name that you will use as reference in the code.Īdjust the additional properties that your button control requires. What if you want someone to be able to exit your program by clicking a button? Using a simple button control and one line of code, you can make it happen.ġ Create a new button control on your C# form by dragging and dropping “button” control from the toolbox window to your form.Ģ In your properties window, give the button a meaningful name. Plus, there is a video screencast at the end for a more detailed explanation. I’ll walk you through the steps with pictures. This article describes how to build the form and generate the code needed for this task. Building an exit, close, or quit button is one of the first steps a programmer needs to learn when developing in C# Visual Studio.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |