Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.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#将值从当前表格1传递到表格2显示非静态错误_C#_Setvalue_Trygetvalue_Newforms - Fatal编程技术网

c#将值从当前表格1传递到表格2显示非静态错误

c#将值从当前表格1传递到表格2显示非静态错误,c#,setvalue,trygetvalue,newforms,C#,Setvalue,Trygetvalue,Newforms,表格2: private void btn_justest_Click(object sender, EventArgs e) { using (var myForm = new FormShowResult()) { myForm.Show(); textBoxNameTest.Text = FormShowResult.TheValue; } } 问题在于存在错误“非静态字段、方法或属性需要对象引用” 如何解决

表格2:

private void btn_justest_Click(object sender, EventArgs e)
{           
    using (var myForm = new FormShowResult())
    {
        myForm.Show();
        textBoxNameTest.Text = FormShowResult.TheValue;
    }
}

问题在于存在错误“非静态字段、方法或属性需要对象引用” 如何解决


我的目的是为Form2函数的参数设置一个值,并在启动Form2时加载函数。

您需要使用
myForm
变量来访问实例,而不是类型名称

public string TheValue
{
    get { return richtb_Show.Text; }
}
  textBoxNameTest.Text = myForm.TheValue;