The Operator "=" is not defined for type "Object" and type "Object"

It might help clear things up if you could post some of the actual code you are using - just to give us an idea of what you are doing as a result of deciding on the object type.

Too be honest the whole idea of a plug-in based system is that you don't need to know the specifics of each plug-in, therefore new ones can be added without requiring the main application to be modified and / or recompiled. Personally I'm just curious to understand the situation that requires you to know about the object type....
 
PlausiblyDamp said:
It might help clear things up if you could post some of the actual code you are using - just to give us an idea of what you are doing as a result of deciding on the object type.

Too be honest the whole idea of a plug-in based system is that you don't need to know the specifics of each plug-in, therefore new ones can be added without requiring the main application to be modified and / or recompiled. Personally I'm just curious to understand the situation that requires you to know about the object type....
Alright then. It's to do with a situation where different people might analyse a given situation in different ways. This is not the actual code, but illustrates what I mean in a very simplified manner.

Visual Basic:
'This is WindowsApplication1. It has no reference to the plug-in.
Public Class Form1
    Implements IDataHandler

    Public Sub AddData(ByVal sPage As String) Implements IDataHandler.AddData
        Me.ComboBox1.Items.Add(sPage)

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim obj As New a

        Dim PlugInInst As IAnalysis

        'Code to find the plug-in and set PlugInInst to an instance omitted.

        PlugInInst.SetHandler(Me)
        PlugInInst.Analyse(obj)
        PlugInInst.SetHandler(Nothing)

    End Sub
End Class

Public Class abc

End Class

Public Class a
    Inherits abc
End Class

Public Class b
    Inherits abc
End Class

Public Interface IAnalysis
    Sub Analyse(ByVal x As abc)
    Sub SetHandler(ByVal Handler As IDataHandler)
End Interface

Public Interface IDataHandler
    Sub AddData(ByVal sPage As String)
End Interface
and
Visual Basic:
'This is the plug-in. It references WindowsApplication1.
Public Class Class1
    Implements WindowsApplication1.IAnalysis
    Private MyHandler As WindowsApplication1.IDataHandler

    Public Sub Analyse(ByVal x As WindowsApplication1.abc) Implements WindowsApplication1.IAnalysis.Analyse
        Dim ty As Type = x.GetType
        Select Case True
            Case ty Is GetType(WindowsApplication1.a)
                MyHandler.AddData("http://www.imdb.com/Glossary/A")
                MyHandler.AddData("http://alpha.org/")

            Case ty Is GetType(WindowsApplication1.b)
                MyHandler.AddData("http://www.beta-uk.org/")

        End Select
    End Sub

    Public Sub SetHandler(ByVal Handler As WindowsApplication1.IDataHandler) Implements WindowsApplication1.IAnalysis.SetHandler
        MyHandler = Handler
    End Sub
End Class
 
Back
Top