Moving on from Small Basic to C# with SharpDevelop
Moving on from Small Basic to C# with SharpDevelopThis is a new version of the movong on to C# tutorial that uses the SharpDevelop IDE instead of Visual Studio. SharpDevelop is a good and straighforward IDE that is easy to download and install and is, probably, a little simpler to use when upgrading from Small Basic. To create a C# program that uses the Small Basic library takes only a couple of minutes.
One of the great things about Microsoft's Small Basic is the Graphics Window; it's one of the built-in objects that let the beginning programmer produce attractive and worthwhile results while learning to program.
Small Basic is a simple language that is reasonably easy to learn but due to its simplicity it lacks some of the more sophisticated features of professional languages like C#. These more advanced features help to make larger programs easier to write and reduce the number of programming errors. However, they sometimes take a while to get your head around.
The aim of this project is to help you to learn C# by taking advantage of what you already know from SB. If you've been working with SB for a while you already know the basics of programming; you know about variables, loops, branching and subroutines. You also know how to use the built-in object like the Graphics Window. Here we are going to provide you with the ability to use the SB library in C# programs. You will use the same built-in objects as you are used to from SB but you will learn the new syntax of C# and the new features of that language. First you need to download SharpDeveop. Search for it in your browser and click on the 'Download' link on the web site. There are various versions to choose from. Here I shall be using version 4.4. This is not the latest version but I am using it because it will run on all Windows versions from XP upwards, and also has the advantage of supporting other languages, such as VB.NET and IronPython (but that is the subject of a later tutorial!).. Version 5 only supports C# and Windows versions from Vista.
Unlike Visual Studio there is no need to create a new template for your Small Basic, C# programs. What follows is the (simple) procedure to create a C# program that can utilise the Small Basic library - features such as the GraphicsWindow and TextWindow.
Your First ProgramThe first thing to do is fire up SharpDevelop. You'll see a screen that asks to you to open an existing Solution (basically a project) or create a newone. Since this i sour first time, obviously we want to start a new one. When you hae done this, select C# and, from the submenu,'Windows Application'. You will then see a panel with options to select from like this:
From the panel select 'Console Project', fill in a name in the form, and click 'Create'.
You will then get the editor pane with a new C# prgram in it, like this.
SharpDevelop has helpfully created a new program for you and also put in some sample code. We don´t really want this, so select the code as shown and delete it.
The next thing we need to do is add a reference to the Small Basic library. Click on the 'Projects' menu and select 'Add Reference'. Then click on '.NET Assembly Browser' and navigate to the directory where your Small Basic library is (on my computer, it is C:/Program Files/Microsoft/Small Basic/Library - if it's not there on you computer, you'll just have t find it yourself!). You need the file SmallBasicLibrary.dll, so select it and click 'open'.
The line is
Don't forget the semicolon at the end on the line!
And it goes here...
That is now a complete C# program that uses the Small Basic library and does absolutely nothing!
So now add this line of code.
So now add this line of code.
This will create and display a SB Graphics window. But you knew that, of course!
Find the green triangle in the menu bar and click on it to run the program. you should see this.
OK, that's it. you can now go onto to the subsequent C# tutorials but bear in mind that these were written to go with the original Visual Studio tutorial. When using SharpDevelop you don't use a VS template, each time you start a new program you go through the procedure outlined here.