Search code examples
vb.netwinformsvisual-studio-2013visual-studio-exp-2013

Type not defined, Visual Studio Express 2013


In Visual Studio Express 2013, I'm making a custom control called "AddressVerifier", which has a custom button called "CustomButton". Every time I modify the form, even just moving a label, it modifies the AddressVerifier.Designer.vb file, which creates a compile error as shown. If I select either of the first two fixes, it compiles fine and all is well until I modify the form again, then it removes the fix for the next compile.

I'm virtually CERTAIN this is a bug, but is there a workaround?

enter image description here


Solution

  • This may be due to a name clash. It appears that you may have a type and a namespace both called AddressVerifier. The IDE is using the name of the namespace in the code but then the compiler is interpreting it as the type. The solution is to not use the same name for two things in the same context.

    EDIT: The suggestion to add the Global qualifier is to force the compiler to interpret the name as the namespace rather than the type. It reverts when the design code file is regenerated because the IDE doesn't scan every possible type and namespace for name clashes, but rather just assumes that you have named things such that they won't happen. It could be considered a limitation but not a bug in the IDE.