Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的应用程序中有 5 个表单,我想从中使用一个表单中的变量并在另一个表单上调用它。我有洗车表格和以旧换新表格。如果我想调用洗车总数并将其与交易总额相加以进行日终销售,我将如何做到这一点。
您必须使用 Form getter 和 setter 来访问和修改这些变量。
public class CarWash: Form { ... public type carWashVariable { get; set; } ... } From Trade form: public void button1_Click(object sender, EventArgs e) { MessageBox.Show(CarWash.carWashVariable); }