" <elementname> " 不明确,因为 <type> "" 中存在多种具有此名称的 <typename> 成员'<elementname>' is ambiguous because multiple kinds of members with this name exist in <type> '<typename>'

表达式可以访问包含同名的多个成员的编程元素,编程元素可在类、结构、模块或接口中定义。An expression accesses a programming element defined in a class, structure, module, or interface that contains more than one member with the same name.

此错误最可能原因是 “区分大小写”The most likely cause of this error is case sensitivity. Visual Basic 名称不区分大小写,这意味着,你可以在代码中的不同位置将名称的首字母大写,或使用小写。Visual Basic names are case-insensitive, which means you can capitalize them differently at different places in your code. 例如,如果使用名称 XYZ 定义某一变量并且之后将其作为 xyz访问,则编译器会将两个名称视为等效。For example, if you define a variable with the name XYZ and later access it as xyz, the compiler considers the two names to be equivalent.

但是,其他语言(如c #Visual C++)区分大小写。However, other languages, such as C# and Visual C++, are case-sensitive. 在这种语言中, XYZxyz 不会被视为同一名称。In such a language, XYZ and xyz are not considered to be the same name. 因此,用这种语言编写的类可以定义一个名为 XYZ 的变量和一个名为 xyz的属性。Therefore, a class written in such a language could define a variable named XYZ and a property named xyz. 公共语言运行库 (CLR) 在程序集中区分大小写。The common language runtime (CLR) preserves case sensitivity in assemblies. 但是,如果 Visual Basic 应用程序用名称 XYZxyz访问程序集,它们将显示为同一名称。However, if a Visual Basic application accesses an assembly with names XYZ and xyz, they appear as the same name.

错误 ID: BC31429Error ID: BC31429

更正此错误To correct this error

  1. 如果你可以控制定义类型的源代码,请考虑对这些成员重命名,使它们除了大小写不同之外,还有其他不同之处。If you have control over the source code of the defining type, consider renaming the members so that they differ by more than only casing. 如果定义类型已发布并被其他应用程序使用,可能无法进行此项操作。This might not be possible if the defining type has already been published and is being used by other applications.

  2. 如果无法重命名定义类型中的成员,请从代码中删除引用的编程元素。If you cannot rename the members in the defining type, remove the cited programming element from your code. 你不能访问对 Visual Basic 而言具有多种定义的元素。You cannot access an element that appears to Visual Basic to have multiple definitions.

另请参阅See also