Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/262.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# 如何创建可以在网站上搜索的usercontrol_C# - Fatal编程技术网

C# 如何创建可以在网站上搜索的usercontrol

C# 如何创建可以在网站上搜索的usercontrol,c#,C#,我确实喜欢创建一个可以在网站上执行搜索查询的usercontrol 这是我的工作代码: public static void SearchGoogle(string GoogleQuery) { Process.Start("https://www.google.com/search?q=" + YoutubeQuery); } private void GsearchBtn_Click(object

我确实喜欢创建一个可以在网站上执行搜索查询的usercontrol

这是我的工作代码:

public static void SearchGoogle(string GoogleQuery)
        {
            Process.Start("https://www.google.com/search?q=" + YoutubeQuery);
        }

        private void GsearchBtn_Click(object sender, EventArgs e)
        {
            SearchGoogle(textBox1.Text);
        }
您可以看到,当用户输入搜索查询时,我的C#表单将搜索该查询。它可以工作,但当我尝试将它添加到一个用户控件上,并使用一个不同的搜索引擎,例如:

public static void SearchYoutube(string YoutubeQuery)
        {
            Process.Start("https://www.youtube.com/results?search_query=" + YoutubeQuery);
        }

        private void GsearchBtn_Click(object sender, EventArgs e)
        {
            SearchYoutube(textBox1.Text);
        }

它一直把我发送到谷歌搜索查询,而不是youtube。如何修复此问题?

尝试清理并重建项目单击处理程序查看它们除了其中的代码外,其他都是相同的。。。你可能需要一个youtube点击处理程序。什么是点击处理程序?