Logo Banner

Velleman K8055 - [K8055 Software Tutorial]

K8055 Tutorial: Creating a Visual Basic Project

1. Create a new project

Now that your K8055D.DLL and Visual Basic Express are installed it is time to start writing some K8055 software. So launch Visual Basic if you didn't do so already. The main screen will appear:

You can start building your application by clicking the "New Project..." button. It appears on the main screen. Alternatively it can be found in the menu File/New Project. You should select 'Windows Forms Application', and give a name to the new project.

2. Select a target framework

You've just created a new project. You will see an empty form that can be filled with controls. You can best begin with setting the properties for this project:

I usually start a project with checking the target .NET framework. This is the version of the .NET framework you are writing a program for. There are several versions of the .NET framework: 1.0, 1.1, 2.0, 3.0, 3.5, 4.0.

In Visual Basic .NET 2010 the default framework is V4.0, which is the latest version. There is nothing wrong with this version but it is not as wide-spread as the 3.5: if you target a program for the .NET 4.0 chances are high end users would have to install the .NET 4.0 framework first. It annoys them because it takes a lot of time to install the .NET runtime files. So I usually target my programs for the 3.5 framework, because that one is included with Vista/Windows 7.

You can check your target framework under the Project Properties: click the menu "Project > -yourprojectname- Properties...". The following screen will show up:

Now you need to navigate to the "Compile" Tab, where you will find the "Advanced Compile Options..." at the bottom. Click this button to show the following screen (The last listbox offers you the possibility to set the target .NET framework. You can set it to the .NET 3.5).

3. Select the right solution platform

One thing you should always check is the 'Platform Setting'. You should set the platform to x86, which means your program should always run as a 32bit process. This is required to get access to the Velleman's K8055D.DLL file.

If you wouldn't check this option, your K8055 program could be executed as a 64bit process when you run it on a 64bit version of Windows. But the Velleman K8055D.DLL is a 32bit DLL file: it cannot be loaded from a 64bit process. You would get the following error:

"A first chance exception of type 'System.DllNotFoundException' occurred"

The given error is confusing, as it suggests your DLL file is missing. Even if the DLL file is located in the right place. The solution is easy: we need to force our application to run as a 32-bit process. This can be done in the configuration manager, under the menu Build\Configuration Manager. You should check if the 'Active Solution Platform' listbox indicates x86.

If it doesn't, you can click the listbox at the right and select New.... Now you will get a dialog box where you can define a new solution platform. Fill in something like this, and click OK.


Copyright ©1998-2017 Vanderhaegen Bart - last modified: August 24, 2013