Instruction manual

AMPDIO DRIVERS
Page 85
that are not passed as pointers and the ‘ByRef’ prefix for function arguments that are passed as
pointers. For example, function TCgetCount requires a pointer to a variable declared as long, into
which the count value result will be placed. A typical VB.NET code example for displaying the Z1
Counter 0 count value would be as follows:
Dim count As Integer
i = TCgetCount(hBoard, Z1, 0, count)' count now contains new
Text1.Text = Str(count) ' value
6.3.5 Visual C# .NET
The Visual C# .NET example projects can be opened from within the Microsoft Visual Studio .NET
development environment by choosing ‘File|Open|Project…’ in the menu and selecting the
appropriate .CSPROJ project file within the EX_C# subdirectory of the AmpDIO software directory.
The project window will now appear on the desktop. Double-clicking on a .CSPROJ file from within
Windows Explorer should also cause Microsoft Visual Studio .NET to run with the selected project
file open. Double-click on any file in the project to view the source code or form design (if both are
present, they are displayed under separate tabs). To run the example, press the F5 key or select
‘Debug|Start’ in the menu.
To create your own Visual C# .NET program from scratch within Microsoft Visual Studio .NET,
perform the following steps:
1) From within Microsoft Visual Studio .NET, select ‘File|New|Project…’ in the menu. In the ‘New
Project’ dialog, choose ‘Visual C# Projects in the ‘Project Types box and ‘Windows
Application’ in theTemplates box. Enter a name for the project and specify a location using
the ‘Browse…’ button. Press the ‘OK’ button to continue.
2) Select ‘File|Add Existing Item’ from the menu and add Dio_tc_h.CS from the the EX_C#
subdirectory of the AmpDIO software directory.
3) On the main menu, select ‘Project|<Project name> Properties...’. Select ‘Configuration
Properties|Build’ on the left-hand panel. On the right-hand panel, set the ‘Code
Generation|Allow Unsafe Code Blocks’ property to ‘True’. Press the ‘OK’ button to close the
project properties dialog.
4) Double-click on the empty Form1 design window to bring up the code window for the
Form1_Load() subroutine. At runtime, this routine will be called when the program first starts
up.
5) Near the top of the source code window, enter the following line to import the DIO_TC.DLL
functions:
using Amplicon.AmpDIO;
6) Add the following declarations to the Form1 class before the ‘main’ function:
short hBoard;
7) Add the following code to the Form1_Load() function:
short i;
short CardType;
for (i = 0; i < DIO_TC.NUMBER_CARD_SUPPORTED; i++)
{
hBoard = DIO_TC.registerBoardEx(i);
if (hBoard >= 0)
{