How to implement plugin in vb.net class

nurman syah 1 Reputation point
2022-10-17T01:46:46.013+00:00

I know this is probably a frequently asked question, but I've been spending all day trying to find a solution to this problem. Now, I am working on a project in which VB is partially used. And in a program that has been made by someone else, there is a VB class that I want to develop little a bit by implementing a plugin in it to support dynamically extendable application core.

My question is how to replace "M1065" and "M1064" by using the plugin that I created earlier?

This is the vb class.

Friend Function GetWinderTrouble(ByVal lr As String) As Integer  
            'Left-side  
            If lr = Constant.YARN_WINDER_L Then  
                Return Me.GetDeviceValue("M1065")   
                'Right-side  
            Else  
                Return Me.GetDeviceValue("M1064")   
            End If  
End Function  

And this is the Plugin that I already created earlier.

Imports IPLCComm  
  
Public Class PlugIn  
    Implements IPLCComm.IPlugIn  
  
Friend Const YARN_WINDER_L As String = "L"  
  
Friend Const GET_WINDERTROUBLE_L As String = "M1065"  
Friend Const GET_WINDERTROUBLE_R As String = "M1064"  
  
Public Function GetWinderTrouble(lr As String) As Integer Implements IPlugIn.GetWinderTrouble  
    If lr = YARN_WINDER_L Then  
        'Left side  
        Return Me.GetDeviceValue(GET_WINDERTROUBLE_L)  
    Else  
        'Right side  
        Return Me.GetDeviceValue(GET_WINDERTROUBLE_R)  
    End If  
End Function  
End Class  

Please help, thank you in advance.

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,668 questions
0 comments No comments
{count} votes