'Property'无法实现'Property',因为接口'IName'上没有匹配的属性

时间:2011-12-09 01:12:37

标签: .net vb.net interface

我现在遇到一些非常奇怪的接口问题。

我的设置非常简单。

在我的一个班级中,我有Property来自Property的{​​{1}}。

在我的课堂上,它就像:

Interface

这是IContainer界面:

Private _oForm As IForm
Public Property Form As IForm Implements IContainer.Form
    Set(value As IForm)
        Me._oForm = value
    End Set
    Get
        Return Me._oForm
    End Get
End Property

这是非常简单的不是吗?根本没有复杂的实现,我似乎无法解决它。

为了它,现在我的IForm里面没有任何东西:

Public Interface IContainer

    Property Form As IForm

    Sub OpenScreen(p_oDataKey As DataKey, Optional ByVal p_oOpenScreenProperties As OpenScreenProperties = Nothing)

End Interface

我总是得到:

Public Interface IForm

End Interface

Error   2   Class 'BaseContainer' must implement 'Property Form As IForm' for interface 'Common.IContainer'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.

我喜欢这样的几十个接口在我的整个项目中工作,我不敢相信这个简单的接口无法工作!请帮我一把:P

非常感谢!

1 个答案:

答案 0 :(得分:0)

检查以确保另一个实现icontainer.form或实现iform.form未添加到类的其他位置。

例如,如果键入Implements IContainer,VB将有助于向您的类添加实现者。如果稍后更改界面,则可能会有剩余的参考。