智能感知没有显示我写的任何内容

时间:2009-12-05 00:28:35

标签: visual-studio-2008 intellisense

我正在使用Visual C#2008 express。我也在运行Windows 7.我创建了一个简单的表单,但是Intellisense没有显示我写的任何内容。 我写道:

private RadioButton rbtn_sortLocation;

然后当我写rbtn时,Intellisense会弹出,但不会显示rbtn_sortLocation。但在写出整行之后,它并没有抱怨错误。我如何让Intellisense显示我的方法等?

另外:这只发生在我在这台计算机上创建的解决方案上。我在旧的XP机器上创建的所有解决方案都可以正常工作。

2 个答案:

答案 0 :(得分:1)

你可以给Ctrl + Space一个镜头。这是一种手动拉出智能感知菜单的方法。

您还可以检查选项以确保其已打开。我相信intellisense选项位于Tools -> Options -> Text Editor -> (All Languages or the language you are using) -> Statement Completion section -> Auto list members

之下

答案 1 :(得分:0)

你在哪里写'rbtn'并尝试打开intellisense?此外,这个RadioButton在哪里宣布?

Intellisense使用基于范围的选项填充菜单。例如:(假设RadioButton在类级别声明)

class MyClass 
{
    private RadioButton rbtn_sortLocation;

    // Intellisense will not show the RadioButton in this scope.
    // This is the class scope, not in a method.

    static void StaticMethod() 
    {
        // Intellisense will not show the RadioButton in this scope.
        // The RadioButton is not static, so it requires an instance.
    }

    class InnerClass
    {
        // Intellisense will not show the RadioButton in this scope.
        // This is the class scope, not in a method.

        void InnerClassMethod()
        {
            // Intellisense will not show the RadioButton in this scope.
            // Members of the outer class are not accessible to an inner class.
        }
    }

    public MyClass()
    {
        // Intellisense WILL show the radio Button in this scope.
        // class members are accessible to the constructor.
    }

    void Method()
    {
        // Intellisense WILL show the radio Button in this scope.
        // class members are accessible to instance methods.
    }
}