The type or namespace cannot be found (are you missing a using directive or an assembly reference?)

前端 未结 5 937
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 14:45

I get the following error when I try to compile my C# program:

The type or namespace name \'Login\' could not be found (are you missing a using directive or an

5条回答
  •  青春惊慌失措
    2020-12-11 15:46

    You don't have the namespace the Login class is in as a reference.

    Add the following to the form that uses the Login class:

    using FootballLeagueSystem;
    

    When you want to use a class in another namespace, you have to tell the compiler where to find it. In this case, Login is inside the FootballLeagueSystem namespace, or : FootballLeagueSystem.Login is the fully qualified namespace.

    As a commenter pointed out, you declare the Login class inside the FootballLeagueSystem namespace, but you're using it in the FootballLeague namespace.

提交回复
热议问题