Moving on from Small Basic to VB.NET


Using the Small Basic Library in VB.NET

(Note there are no screenshots in this tutorial - I doubt that they are necessary but I can put them in later if asked!)

This is a very short tutorial to show you how to create a project template for VB.NET that will let you use the Small Basic library in a VB program.

In many ways the progression from Small Basic to VB is a natural one because the syntax is the same, or similar, in each language. However, the learning curve for VB can be quite daunting. So, being able to use the skills that you developed in Small Basic directly in VB has to be a good idea!

Once you created the project template, you'll be able to write VB programs that use all of the great parts of SB, like the Graphics Window.

By the way, if you've followed my tutorial about how to do this in C#, I have to tell you that this is MUCH EASIER because we can use the "Graduate" button in the Small Basic IDE as a starting point.

Visual Studio Express

The first thing you need to do is to download and install Visual StudioExpress for Visual Basic. I'm not going to go through thi here because the instructions from Microsoft are perfectly good. So, off you go to the MS web site and search for Visual Studio Express.

I'm going to be using the 2010 version of Visual Studio Express because it runs on older versions of Windows. There is a 2012 version, too.

Create a Small Basic program


Open Small Basic and in the program window just type a comment such as:

'Write your code here

That's all.

Now click on the Graduate icon. This is going to create a VB program from which we will create our template.

SB will ask you for a location where you want to create the VB program. This can be anywhere but I suggest that a sensible place to put it would be in the Visual Studio Projects folder - you'll find this in My Documents.

Small Basic will automatically start Visual Studio Express and the first thing you will see is the VS conversion tool. Simply click next to get it going.

Now it will ask you if you want to back up the program. There really isn't much point in this - even if something goes wrong, it won't be too difficult to recreate a program with a single comment! So, select 'no'.

The conversion tool will now tell that it is ready to convert and you simply click 'Finish' and pretty quickly it will tell you that it has finished (you have the option of showing the conversion log - don't bother).

Now you will have Visual Studio Express displayed on your screen in all its glory with a new project opened. We aren't going to use this project directly, so don't open any files.

Go to the File menu and select 'Export Template' and on the next screen just ensure that 'Project Template' is checked and click 'Next'.

On the next screen give the template a name (I called mine 'VBSB') but don't use spaces in the name and also fill in the description will something like "Small Basic Library application for VB". Then click 'Finish'.

That's all there is to it.

Now close the current project from the file menu (there's no need to save it) and then open a new one. On the list of project types you will find the one you've just created. Select that, give it a name and off you go!

When the project is opened, you will want to write some code. If the program file is not open find it in the explorer window on the left and double click it.

With the program file open you should see a basic VB program. In that program will be the comment that was in the original SB. Replace this with something simple like:

GraphicsWindow.Show()

and then run the program by clicking the green triangle in the top tool bar.

I think you know what will happen.

You can play around writing SB code safe in the knowledge that since SB is similar to VB, it is likely to work fine. Or you can wait for my next tutorial!


Comments

Popular posts from this blog

Just Enough Python

Learn to code with C

Introduction to Python by Andrew Ng