Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# C中应为类、委托、枚举、接口或struckt错误#_C# - Fatal编程技术网

C# C中应为类、委托、枚举、接口或struckt错误#

C# C中应为类、委托、枚举、接口或struckt错误#,c#,C#,我有这个错误,我不知道如何修复它,我找不到我的代码有什么问题,所以我向正在阅读这篇文章的ppl寻求帮助,并知道解决方案。 错误出现在按钮空白处(除了开始按钮空白处)。尝试在URLtexbox和Combobox之间切换,但在某个地方我搞砸了,我尝试了很多方法来修复它,但我找不到如何修复它 这是我的密码: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; us

我有这个错误,我不知道如何修复它,我找不到我的代码有什么问题,所以我向正在阅读这篇文章的ppl寻求帮助,并知道解决方案。 错误出现在按钮空白处(除了开始按钮空白处)。尝试在URLtexbox和Combobox之间切换,但在某个地方我搞砸了,我尝试了很多方法来修复它,但我找不到如何修复它

这是我的密码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Web;

namespace ****
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            webBrowser1.ScriptErrorsSuppressed = true;
        }

        private void startbutton_Click(object sender, EventArgs e)
        {
            switch (Text)
            {
                case "full":
                    {
                        webBrowser1.Navigate(URLtextbox.Text);
                    }
                    break;

                case "empety":
                    {
                        webBrowser1.Navigate(comboBox1.Text);
                    }
                    break;
            }
        }
    }

        private void stopbutton_Click(object sender, EventArgs e)
        {
            webBrowser1.Stop();
        }

        private void forwardbutton_Click(object sender, EventArgs e)
        {
            webBrowser1.GoForward();
        }

        private void backbutton_Click(object sender, EventArgs e)
        {
            webBrowser1.GoBack();
        }
}
感谢您的帮助^。^

必须在类中定义这3种方法(
stopbutton\u Click
forwardbutton\u Click
backbutton\u Click


或者换句话说:将类的右括号移到最后一个方法的下方。

您的开关不引用任何方法variable@GuillaumeBeauvois实际上,主窗体上有一个“Text”属性。它可能不是预期的,但它是有效的。哦,好吧,既然没有显示属性,我认为这可能是未来的问题,所以只想指出它继承自
表单
,因此它不会显示,除非它被覆盖或阴影。我做了“full”和“empety”在purpos上,为了及时,我可以记住,如果URLtexbox中有文本,我知道它必须是texbox,它也有查找