Ok, what i'm about to show you in this tutorial can be done using Microsoft Powerpoint, maybe a few more Microsoft Office programs even but i'm gonna show you it in visual basic which was, obviously designed for this. I recommend saving on every paragraph just to make sure you don't lose your work.
So to start, open visual basic or another program if you're using that (i'll assume you're using powerpoint if you're not using visual basic.) (NOTE: if you're using powerpoint then you will need to go to view>>>toolbars>>>visual basic and open up that and then view>>>toolbars>>>control toolbox.) So then you'll have a blank form infront of you.

The first thing we're gonna do is make some text and then when you click the button the text changes to something different.
So start off by creating your text. To do this, go to the side panel and click on the button which is a capital 'A' (not the 'ab' one, we'll get to that later). Take your mouse to the form and click and drag your mouse to how big you want your label.

We've created ours near the top. The thing we just created is a label. At the side you'll see a load of options down the side to do with it. Make sure the label is selected. At the side, there's a name option, this shows the labels name, in this case label1 (this is what the program will refer to it as in the code) and another one is a caption one. This is where you can control what the label says. Click on the box to the right of the word caption and type in 'hello!" just without the speech marks.
In the same part of the screen where you got your label from, there will be a picture that looks like a button. Click on that and then to put it on your form/program, do the same. Click and drag to show how big you want it. Then make sure this is selected and then change the buttons caption to 'Button'. You'll end up with something looking like this:

Now to make it do something. Double click the button and a screen with some text will come up. This is the coding for it. It will currently contain this:
So to start, open visual basic or another program if you're using that (i'll assume you're using powerpoint if you're not using visual basic.) (NOTE: if you're using powerpoint then you will need to go to view>>>toolbars>>>visual basic and open up that and then view>>>toolbars>>>control toolbox.) So then you'll have a blank form infront of you.

The first thing we're gonna do is make some text and then when you click the button the text changes to something different.
So start off by creating your text. To do this, go to the side panel and click on the button which is a capital 'A' (not the 'ab' one, we'll get to that later). Take your mouse to the form and click and drag your mouse to how big you want your label.

We've created ours near the top. The thing we just created is a label. At the side you'll see a load of options down the side to do with it. Make sure the label is selected. At the side, there's a name option, this shows the labels name, in this case label1 (this is what the program will refer to it as in the code) and another one is a caption one. This is where you can control what the label says. Click on the box to the right of the word caption and type in 'hello!" just without the speech marks.
In the same part of the screen where you got your label from, there will be a picture that looks like a button. Click on that and then to put it on your form/program, do the same. Click and drag to show how big you want it. Then make sure this is selected and then change the buttons caption to 'Button'. You'll end up with something looking like this:

Now to make it do something. Double click the button and a screen with some text will come up. This is the coding for it. It will currently contain this:
| CODE |
| Private Sub Command1_Click() End Sub |
There's nothing to worry about there. That's just saying "the bit in between this top line and the bottom line will happen when the button is clicked".
Remember that the label was called 'label1' and the text in it is called 'caption'? Well, to tell the program that we want it to change or alter the caption we type in 'label1.caption = ' and then what you want to change it to. We want to make it say what's currently in the box and then after that, 'additional text'. So to do this we first put 'label1.caption = label1.caption' and this will make it say exactly the same. To tell it we want it to say something else after that, we type in an '&' sign and then after that we type in (in speech marks) '"additional text"'. We have to put this last bit in speech marks otherwise it thinks we are using a keyword (we'll learn about them in a later lesson).
So altogether it says:
| CODE |
| Private Sub Command1_Click() label1.caption = label1.caption & "additional text" End Sub |
Once you've done this, press the play button at the top (if you're using powerpoint click F5 or "view slideshow"
and it should come out looking like this:

Our label is obviously too thin since the writing goes onto the next line so we're gonna make it wider and if you want to do this, just make sure it's selected and then drag the square on the left or right.
Now we're gonna get more complicated. We're gonna make a bit of text which you can edit while the program is running and then it appears in another editable textbox and our label.
So, to do this, use the button at the side which looks like a textbox and has 'ab|' typed in and then click and drag 2 of them side by side. These are called text boxes and the program refers to these as text1 and text2. The text you can edit in them is also called 'text' and not caption this time.
Double click the button again to open the coding window again.
Delete the line you just wrote (not the top line and bottom line though). We're gonna write something new. Write down 'label1.caption = "hello" & text2.text'. This is just saying "put "hello" in label1's caption, followed by whatever text1 says." Then start a new line by pressing enter (still between the original top and bottom lines) and put 'text2.text = text1.text'. Your code should look like this:
| CODE |
| Private Sub Command1_Click() label1.caption = "hello" & text2.text text2.text = text1.text End Sub |
If you press play you will see something similar to this:

You will probably notice that it doesn't quite work. Visual Basic goes through the code 1 line at a time so it'll look at the first line, does what that says and then moves on to the next line etc. Because of this, when it told label1 to say what text1 was saying, text1 was saying 'Text1' at that moment. To fix this, we're gonna switch our lines around so it reads this:
| CODE |
| Private Sub Command1_Click() text2.text = text1.text label1.caption = "hello" & text2.text End Sub |
It should work this time and look like this:

So there you have it, your very first code. It doesn't do much at the minute so we'll expand on it in part 2.
Post any questions you may have below.
Thanks for reading and i hope it helped. If you're not joined on the forums already then feel free to join
discuss this topic to forum
