Can’t find a program for your computer that does what you need it to? We explain how to make one yourself with this simple programming tool
Computer programming tends to evoke images of professionals working for companies such as Microsoft but, in reality, lots of software is made by individuals. Programming can also be handy if you ever want to tweak a macro in Word or help with some maths homework. But it’s often hard to get started.
For that reason, we will explain how to use Small Basic, a simple tool made by Microsoft that allows you to create programs. It will also teach you concepts that will prove essential if you go on to more complicated projects.
Getting Small Basic
You can download Small Basic from the Computeractive website. You will need the Microsoft .NET Framework 3.5 installed on your computer for Small Basic to work – if your computer reports that this is missing, get a copy free from Microsoft. Once both are installed, you are ready to get started.
When you create your first program it’s traditional to write one that says ‘Hello World’, so let’s try this first. Click the Start button, All Programs, Small Basic and then Microsoft Small Basic. This will open the Small Basic Window. There is a toolbar at the top and an area for writing the code, which is white and says Untitled in the title bar. There is a blue column on the right-hand side of the window. This displays help about commands as you write them.
Left-click inside the white text area. There is a small ‘1’ in the grey margin – like many other programming languages, Small Basic numbers the lines in a program as this makes it easier to track problems. Type the following line:
TextWindow.WriteLine(“Hello World!”)
As you might have already guessed, this line of code tells the computer to write one line – ‘Hello World!’ in a text window. Click on the Run button or press F5 to see it in action, and as promised another window appears with the text “Hello World! Press any key to continue” inside it. Press any key to close the program and return to Small Basic.
Small Basic helps you write code in two ways. Firstly, it suggests commands as you type in a list that appears underneath the cursor. So, if you start to type a command you will see options appear – if you know the one you want, use the up and down arrow keys to move through the options and choose it. This makes typing code quicker, and cuts down on mistyping errors.
Secondly, it colours text to show what Small Basic thinks the text is. This is useful when tracking down problems. For example, let’s deliberately add another line to the program that includes an error to show how Small Basic will help fix it. Enter the following code on line two:
TextWindow“WriteLine(“Hello Mum!”)
You will notice that the colours used to display this line look different to the one above. Click on the Blue Run arrow and instead of the text window of the preview example, an error message will appear at the bottom of the text entry window. In this case it says “Sorry, we found some errors… 2,11: Unrecognised statement encountered.”
This found the error we deliberately put into that line. The first number, 2, tells you which line of the program contains the error, and the second shows how many letters along it lies.
Hopefully you have noticed that this is because there is a quotation mark (“) where there should be a full stop. Correct this, and you will see that the colours in that line match the ones from the line above - a good sign that it’s ready to go. Press F5 to run the program.
Article tags
Related articles
Q.Is my phone’s Bluetooth any use?
Q.Can I switch boot drives so that I can work on older...
Q.Can I open my old genealogy files or have they gone...
A 'small British village' in the mid-Atlantic is in need of funding to get it connected
Voice over IP. The routing of voice conversations over the internet, which is cheaper than the telephone...
|
|
|
|
|
Computeractive Excel (2010) Online tutorialPrice: £19.99 |
Computeractive Word (2010) Online TutorialPrice: £19.99 |
Computeractive Powerpoint (2010) Online TutorialPrice: £19.99 |
Angry BirdsPrice: £9.99 |
Back Issue CD-Rom 14 (2011)Price: £15.99 |