Getting started using Visual Basic
To use RCAPINet in a Visual Basic .NET project, declare a Spel Class instance, as shown in the example below. g_spel can now be used in your project.
- In Visual Studio .NET, select File | Project.
- Select the following type for the Visual Basic project.
- .NET Framework : "Windows Forms App (.NET Framework)"
- .NET6 : "Windows Forms App"
- Select [Project]-[Add Reference].
- In the [Browse] tab, select the "RCAPINt2.dll" file under the "\API" directory.
- .NET Framework : \Assembly\net462
- .NET6 : \Assembly\net6.0-windows
- From the Project menu, create a new module and add the following code.
Module Module1
Public WithEvents g_spel As RCAPINet.Spel
Public Sub InitApp()
g_spel = New RCAPINet.Spel
With g_spel
.Initialize
.Project = "c:\EpsonRC80\projects\API_Demos\Demo1 \demo1.sprj"
End With
End Sub
Public Sub EventReceived( _
ByVal sender As Object, _
ByVal e As RCAPINet.SpelEventArgs) _
Handles g_spel.EventReceived
MsgBox("received event " & e.Event)
End Sub
End Module
KEY POINTS
When your application exits, you need to execute Dispose for each Spel class instance. This can be done in your main form's FormClosed event. If Dispose is not executed, the application will not shutdown properly.
g_spel.Dispose()