如何将Form1值发送到其他cs

我知道如何将值Form1发送到Form2,它工作正常;

FORM1;

public static string sirket = ""; public static string personeladı = ""; public static string desc = ""; public static string toplampay = ""; private void prew_Click(object sender, EventArgs e) { List myList = new List(); foreach (ListViewItem lvi in this.listView1.Items) { myList.Add(lvi); } sirket = companyname.Text; personeladı = personelcombo.Text; desc = paydesc.Text; toplampay = totalpay.Text; Form2 frm2 = new Form2(listView1); frm2.Show(); } 

FORM2;

  string com = Form1.sirket; string pers = Form1.personeladı; string descrip = Form1.desc; string toppay = Form1.toplampay; 

我的问题是我有一个表单名称Form1 (它是一个表单),我写了Listviewprint.cs (不是表单)。我想将值Form1发送到Listviewprint.cs但是当我尝试使用上面的代码时它给我错误;

 The name 'Form1' does not exist in the current context. 

如何将值Form1发送到Listviewprint.cs 在此处输入图像描述

对我来说不是100%清楚你真正想做什么,但我认为这会对你有所帮助。 如果你不清楚的话,请评论一下。

你有Form1类,并在其中声明了ListViewPrint 。 之后,您可以在Form1设置它的公共属性

 public partial class Form1 : Form { private ListViewPrint _mylistviewPrint; public Form1() { InitializeComponent(); _mylistviewPrint = new _mylistviewPrint(/*or with your parameters*/); } public void DoSomethingInForm1() { _mylistviewPrint.SomeVariable = 52; } } public class ListViewPrint { private int _somevariable; public int SomeVariable { get { return _somevariable; } set { _somevariable = value; } } private string _othervariable; /// like the above }