C#winFrom中怎么把一个窗体文本框赋值给多个不同窗体,怎么判断窗体?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Q714723
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
new Form2().Show();
new Form3().Show();
new Form4().Show();
}
private void button2_Click(object sender, EventArgs e)
{
foreach (Form item in Application.OpenForms)
{
if (item != this)
(item.Controls["textBox1"] as TextBox).Text = textBox1.Text;
}
}
}
}