API Help
EPLAN API / User Guide / API Framework / Add-ins / Creating add-ins in Visual Basic.Net
In This Topic
    Creating add-ins in Visual Basic.Net
    In This Topic

    Writing an add-in in Visual Basic.Net basically works exactly like already describes under the topic"Creating add-ins in CSharp". The only difference is the source code syntax and how to call the compiler. 

     

    Create a file VBAddInModule.vb with the following contents: 

    VB
    Copy Code
    Public Class AddInModule
       Implements Eplan.EplApi.ApplicationFramework.IEplAddIn
    
       Public Function OnRegister(ByRef bLoadOnStart As System.Boolean) As Boolean _
         Implements Eplan.EplApi.ApplicationFramework.IEplAddIn.OnRegister
          bLoadOnStart = True
          Return True
       End Function 'OnRegister
    
       Public Function OnUnregister() As Boolean _
        Implements Eplan.EplApi.ApplicationFramework.IEplAddIn.OnUnregister
          Return True
       End Function 'OnUnregister
    
       Public Function OnInit() As Boolean _
        Implements Eplan.EplApi.ApplicationFramework.IEplAddIn.OnInit
          Return True
       End Function 'OnInit
    
       Public Function OnInitGui() As Boolean _
        Implements Eplan.EplApi.ApplicationFramework.IEplAddIn.OnInitGui
          Return True
       End Function 'OnInitGui
    
       Public Function OnExit() As Boolean _
        Implements Eplan.EplApi.ApplicationFramework.IEplAddIn.OnExit
          Return True
       End Function 'OnExit
    End Class 'AddInModule
    

    Invoke the Visual Basic compiler (vbc.exe) with the following parameters: 

    vbc /target:library /reference:..\..\..\..\bin\Eplan.EplApi.AFu.dll /out:SimpleVBAddIn.dll VBAddinModule.vb 

     

    For an action create the following source file and save it as SimpleVBAction.cs in your source directory. To create an action, we need a class, which implements the IEplAction interface. For a more detailed explanation, see the Actions topic. 

    VB
    Copy Code
    Imports Eplan.EplApi.ApplicationFramework
    
    Public Class VBAction
       Implements IEplAction
       Public Function Execute(ctx As ActionCallingContext) As Boolean Implements IEplAction.Execute
          Dim message as Decider = New Decider
          message.Decide(EnumDecisionType.eOkDecision, "VBAction was called!", "", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK)
          Return True
       End Function 'Execute
    
       Public Function OnRegister(ByRef Name As String, ByRef Ordinal As Integer) As Boolean _
        Implements IEplAction.OnRegister
          Name = "VBAction"
          Ordinal = 20
          Return True
       End Function 'OnRegister
    
       Public Sub GetActionProperties(ByRef actionProperties As ActionProperties) _
        Implements IEplAction.GetActionProperties
          actionProperties.Description = "Action test with parameters."
       End Sub 'GetActionProperties
    End Class 'VBAction
    

     

     

    vbc /target:library /reference:..\..\..\..\bin\Eplan.EplApi.AFu.dll /reference:..\..\..\..\bin\Eplan.EplApi.Baseu.dll /out:SimpleVBAddIn.dll VBAddinModule.vb SimpleVBAction.vb