C#中在两个窗体之间如何传递数值

来源:百度知道 编辑:UC知道 时间:2024/05/21 20:37:09
大虾门,请问C#中在两个窗体之间如何传递数值,
我已经解决了这个问题.不过还是谢谢大家.

Form1.cs
private void button1_Click(object sender, System.EventArgs e)
{
string Name = textBox1.Text;
string Subject = comboBox1.SelectedItem.ToString();
string Symbol = comboBox2.SelectedItem.ToString();
AnotherForm form = new AnotherForm(Name, Subject, Symbol);
//form.Show(); // To show the form modelessly
form.ShowDialog(); // To show the form modally
}

============================================
AnotherForm.cs
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WindowsApplication12
{
/// <summary>
/// Summary description for AnotherForm.
/// </summary>
public class AnotherForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.F