我正在开发一个可以跨多个搜索引擎进行浏览器搜索的应用程序。我目前正在设置界面,这是我的代码:
namespace OIT
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public void TestButton(object sender, EventArgs e)
{
Process proc = new();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.FileName = "https://google.ca/search?q=" + GoogleTextBox.Text;
proc.Start();
}
public void DuckDuckGo_Click(object sender, EventArgs e)
{
Process proc = new();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.FileName = "https://duckduckgo.com/?q=" + DDGTextBox.Text;
proc.Start();
}
private void SearchAll_Click(object sender, EventArgs e)
{
if (GoogleTextBox.Text + DDGTextBox.Text == "")
{
MessageBox.Show("Please enter search terms.");
}
else
{
TestButton();
DuckDuckGo_Click();
}
}
}
}
问题是按钮上的testbutton()和duckduckgo_click();方法导致参数错误:
错误 CS7036
没有给出与“Form1.TestButton(object, EventArgs)”所需的形参“sender”相对应的参数
有人能帮我解决这个问题吗?我确信这是一个超级简单的解决方法,但我已经完成了所有类似的问题,但我无法弄清楚。
谢谢!