Microsoft KB Archive/299799

= FIX: Creating A Class with the Same Name as a Base Class Causes Error =

Article ID: 299799

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q299799



SYMPTOMS
If you create a class by using the DEFINE CLASS command that has the same name as one of the Visual FoxPro (VFP) base classes, you receive the following error message when the class is instantiated:

OLE error code 0x80020006: Unknown name.



CAUSE
Custom classes cannot have the same name as base classes. If you try to compile the project into a dynamic-link library (DLL), you receive the following error message:

Class name is invalid.



STATUS
This problem was corrected in Visual FoxPro version 7.0 for Windows.



Steps to Reproduce Problem
Save the following code as a program, and then run the program: *!* Q299799 FIX: Creating A Class With The Same Name As A Base Class Causes Error LOCAL lcVar CREATE PROJECT oleclasstest NOWAIT

lcVar = &quot;DEFINE CLASS Column AS CUSTOM OLEPUBLIC&quot; + CHR(13) + CHR(10) + ; &quot;  Test = ''&quot; + CHR(13) + CHR(10) + &quot;ENDDEFINE&quot;

=STRTOFILE(lcVar, 'Test.prg', .F.) _VFP.ACTIVEPROJECT.FILES.ADD('Test.prg') _VFP.ACTIVEPROJECT.BUILD('test.dll', 4) oObject = CREATEOBJECT('test.Column') CLEAR ? oObject.Test ? oObject.BASECLASS

Keywords: kbbug kbfix kboop kbcodesnippet kbvfp700fix KB299799

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.