Error BC30002 - Type XXX is not defined

前端 未结 5 1424
春和景丽
春和景丽 2021-01-17 11:54

OK, this begins to drive me crazy. I have an asp.net webapp. Pretty straightforward, most of the code in the .aspx.vb, and a few classes in App_Code.

The problem, wh

5条回答
  •  粉色の甜心
    2021-01-17 12:31

    I think I found the problem.

    My code was like that :

    Imports CMS
    
    Sub Whatever()
        Dim a as new Arbo.MyObject() ' Arbo is a namespace inside CMS
        Dim b as new Util.MyOtherObject() ' Util is a namespace inside Util
    End Sub
    

    I'm not sure why I wrote it like that, but it turns out the fact I was calling classes without either calling their whole namespace or importing their whole namespace was triggering the error.

    I rewrote it like this :

    Imports CMS.Arbo
    Imports CMS.Util 
    
    Sub Whatever()
        Dim a as new MyObject()
        Dim b as new MyOtherObject()
    End Sub
    

    And now it works...

提交回复
热议问题