CSharp forms application 2
In our CSharp forms application 2 , we shall be discussing the addition of a control and its working inside the Form.The controls in the forms are basically the objects from Drawing class and they perform some actions when a user interacts with them.For example, the clicking event of a button control can show us some message. The main thing we’ll do is to add a button control to the clear form. We’ll then compose a single line of code, so you can perceive how things work.
Windows Forms controls are the reusable elements that the end user of the computer program practicality interacts with, to access Windows applications. A button is a form of control, that is an interactive element that allows users to speak with the application in order to perform their desired tasks. The Button category inherits directly from the Button Base Class. A Button will be clicked by using the MOUSE, ENTER key, or SPACEBAR if the button has focus.
In the event that you need to add a control to a Form, you can utilize the Toolbox on the left of Visual Studio. Move your mouse over to the Toolbox, and then, click the plus sign to controls categories.You can then select the desired control from there
Now, right click the button and see its properties
We can sort the properties in alphabetical order also
We will now, change the text of the button
Now, click on the button to get its click event like this:
Add the following code, run the program and see the Message on the Message box