Download User manual

Transcript
11. Using Yocto-4-20mA-Rx with Visual Basic .NET
VisualBasic has long been the most favored entrance path to the Microsoft world. Therefore, we had
to provide our library for this language, even if the new trend is shifting to C#. All the examples and
the project models are tested with Microsoft VisualBasic 2010 Express, freely available on the
Microsoft web site1.
11.1. Installation
Download the Visual Basic Yoctopuce library from the Yoctopuce web site2. There is no setup
program, simply copy the content of the zip file into the directory of your choice. You mostly need the
content of the Sources directory. The other directories contain the documentation and a few
sample programs. All sample projects are Visual Basic 2010, projects, if you are using a previous
version, you may have to recreate the projects structure from scratch.
11.2. Using the Yoctopuce API in a Visual Basic project
The Visual Basic.NET Yoctopuce library is composed of a DLL and of source files in Visual Basic.
The DLL is not a .NET DLL, but a classic DLL, written in C, which manages the low level
communications with the modules3. The source files in Visual Basic manage the high level part of the
API. Therefore, your need both this DLL and the .vb files of the sources directory to create a
project managing Yoctopuce modules.
Configuring a Visual Basic project
The following indications are provided for Visual Studio Express 2010, but the process is similar for
other versions. Start by creating your project. Then, on the Solution Explorer panel, right click on your
project, and select "Add" and then "Add an existing item".
A file selection window opens. Select the yocto_api.vb file and the files corresponding to the
functions of the Yoctopuce modules that your project is going to manage. If in doubt, select all the
files.
You then have the choice between simply adding these files to your project, or to add them as links
(the Add button is in fact a scroll-down menu). In the first case, Visual Studio copies the selected
files into your project. In the second case, Visual Studio simply keeps a link on the original files. We
recommend you to use links, which makes updates of the library much easier.
1 http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-basic-express
2 www.yoctopuce.com/EN/libraries.php
3 The sources of this DLL are available in the C++ API
www.yoctopuce.com
63