Creating your first GUI

Hello,
This post will show you how to create your first GUI (Graphical User Interface)

A Graphical User Interface is the part of the program the user sees, like buttons, text boxes and labels etc.

To start this, create a new project on Visual C# Express and you’ll see a box in the middle of the screen (if you done the Hello World! program from the last post you’ll know what this is.)

Inserting a Label – Use the toolbox on the left hand side of the screen and search for label. Click on label then click on the box in the middle, when you’ve done that click the label when it’s on the box and look to the bottom right corner of Visual C#. You will see properties, scroll down the properties look for the text property and it will say “Label1” you can click that and edit it to anything of your choice.

Insterting a Button – Using the toolbox again, scroll down the toolbox until you see the button tool, click on it then click on your form (box in the middle.) You can adjust the size of your of your button by going to the edge of it and using the squares on the corners to make it bigger. Again, you can go to the properties tool and change the text property to whatever you want the button to say.

Insterting a Textbox – Using the toolbox, select the textbox tool near the bottom and this time click the tool and drag it into your form to adjust the size of it. Textboxes are normally a blank property but if you want text in here such as “Enter here” you can edit the text property the same way you have edited the button text and the label.

 

If you’re going to use a label to display text you will need to change the name of the properly, to do this click on your label then scroll up the properties until you can see the name property which is usually ‘Label1’

 

Leave a comment