VB .NET 2003 and okFrontPanel.dll help

Does anyone have a working example of incorporating okFrontPanel.dll with VB .Net 2003?

I’ve tried to alter the example for incorporating okFrontPanel.dll with VB6 to work with VB .NET 2003 but I can’t get it to work.

TIA,
Frank N

Hi FrankN,

I’ve found that to use the dll in VB.NET you don’t actually use the okFrontPanel.dll. You must use the C# dll libFrontPanel-csharp.dll.

To get it to work in VB.NET

  1. Add the libFrontPanel-csharp.dll as a reference
  2. Make sure in the reference window that libFrontPanel-csharp.dll will be copied locally.
  3. Add the file libFrontPanel-pinv.dll to the project and make it copied to output directory. (Important, do not add this file as a reference)
  4. Import the COM Library
Imports com.opalkelly.frontpanel
  1. Create a new instance of the front panel interface
Public opalKellyBoard As New okCUsbFrontPanel
  1. You can then use the API functions to connect / program / communicate with the OpalKelly Device.

For example:

[CODE] Dim opalKellyBoard As New okCUsbFrontPanel

    'Only One Device Connected To The Computer
    Dim DevSer As String = opalKellyBoard.GetSerialNumber()
    Dim Code As Integer = opalKellyBoard.OpenBySerial(DevSer)
    MsgBox(Code)
    Code = opalKellyBoard.ConfigureFPGA("Path to a .BIT file")
    MsgBox(Code)[/CODE]

-Rob

Rob,

First of all, thanks for the help. I really appreciate it.

Second, can you clarify how to proceed with step #3:

“3. Add the file libFrontPanel-pinv.dll to the project and make it copied to output directory. (Important, do not add this file as a reference)”

How do I actually add libFrontPanel-pinv.dll to the project without adding it as a refernece? And what ouput directory are you talking about?

Regards,
Frank

Frank,

To add the file to the project, you must go to Project -> Add Existing Item. On the file select box make sure the file filter is set to All files. Then select the libFrontPanel-pinv.dll from the opal kelly directory. Once it is added to the project you will see it in the solution explorer. Right click on the libFrontPanel-pinv.dll file in the solution explorer and click properties. There should be an option “Copy to Output Directory”. Make sure that says “Copy Always”

-Rob

Frank,

The main reason to add libFrontPanel-pinv.dll to the project is just so you don’t have to remember to copy the file yourself. It must always be in the directory where the executable of your program is. In your development case the debug folder. This is what the Copy to Output Directory option does.

-Rob

PS: Also thinking about it, the reference libFrontPanel-csharp.dll should also have an always copy option that must be set as well. These two DLL files libFrontPanel-csharp.dll and libFrontPanel-pinv.dll must be in the same directory as your programs executable and if you setup the project like I talked about it should be done automatically.