Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.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# 没有给出与require formal参数(从表单打开表单)对应的参数_C# - Fatal编程技术网

C# 没有给出与require formal参数(从表单打开表单)对应的参数

C# 没有给出与require formal参数(从表单打开表单)对应的参数,c#,C#,我一直在尝试将代码移动到单独的类中,并更改了以下内容: public partial class Questionnaire : Form { public Questionnaire() { InitializeComponent(); } 到 表格1包含打开调查问卷的按钮1 private void button1_Click(object sender, EventArgs e) { Questionnaire q

我一直在尝试将代码移动到单独的类中,并更改了以下内容:

public partial class Questionnaire : Form
{

    public Questionnaire()
    {
        InitializeComponent();            
    }

表格1包含打开调查问卷的按钮1

private void button1_Click(object sender, EventArgs e)
{
    Questionnaire q1 = new Questionnaire();
    q1.ShowDialog(); // Shows GPU_Suggestion
}
关于问卷q1=新问卷()

下面的错误消息显示-没有给定与“inventory.inventory(GetComponentSQL)”的必需形式参数“argGetComponentSQL”相对应的参数

我已将按钮1更改为单击:

private void button1_Click(object sender, EventArgs e)
{
    Questionnaire q1 = new Questionnaire(GetComponentSQL argGetComponentSQL);
    q1.ShowDialog(); // Shows GPU_Suggestion
}
但随后会收到以下3条错误消息:

应为语法错误“,”

“GetComponentSQL”是在给定上下文中无效的类型

当前上下文中不存在名称“argGetComponentSQL”

你在干什么? 如果要使用按钮打开表单,请执行以下操作:

Form2 questionnaire = new Form2();
questionnaire.Show();
this.Hide();
排队

Questionnaire q1 = new Questionnaire(GetComponentSQL argGetComponentSQL);
您正试图声明名为argGetComponentSQL的GetComponentSQL类型的新变量。这在将参数传递给构造函数(或任何其他方法或函数)的上下文中不起作用。相反,您必须在新问卷实例化之前的一行声明变量,然后在将其作为参数传递给构造函数之前对其进行初始化

Questionnaire q1 = new Questionnaire(GetComponentSQL argGetComponentSQL);