C# 窗体调用的有关问题,求
C# 窗体调用的问题,急求!
怎样在窗体form3的标签lable里显示窗体form1文本框text中的内容,怎样调用??好困惑!求详细代码解释
------解决方案--------------------
不管什么关系都很好解决的
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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Broadcasting.setValue(textBox1.Text);
}
private void button2_Click(object sender, EventArgs e)
{
Form2 form2 = Form2.showfrom();
form2.Show();
}
private void button3_Click(object sender, EventArgs e)
{
Form3 form3 = Form3.showform();
form3.Show();
}
}
public delegate void SetTextValue(object value);
/// <summary>
/// 广播类
/// </summary>
public class Broadcasting
{
//event
public static SetTextValue setTextValue;
public static void setValue( object value)
{
if (setTextValue != null)
{
setTextValue(value);
}
}
}
}
------解决方案--------------------
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 WindowsFormsApplication2
{
public partial class Form2 : Form
{
public static Form2 form2 = null;
public Form2()
{
InitializeComponent();
Broadcasting.setTextValue += new SetTextValue(setValue);
}
void setValue(object value)
{
label1.Text = value.ToString();
}
public static Form2 showfrom()
{
if (form2 == null)
{
form2 = new Form2();
}
return form2;
}
}
}
------解决方案--------------------
怎样在窗体form3的标签lable里显示窗体form1文本框text中的内容,怎样调用??好困惑!求详细代码解释
C#,窗体,调用
------解决方案--------------------
不管什么关系都很好解决的
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 WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Broadcasting.setValue(textBox1.Text);
}
private void button2_Click(object sender, EventArgs e)
{
Form2 form2 = Form2.showfrom();
form2.Show();
}
private void button3_Click(object sender, EventArgs e)
{
Form3 form3 = Form3.showform();
form3.Show();
}
}
public delegate void SetTextValue(object value);
/// <summary>
/// 广播类
/// </summary>
public class Broadcasting
{
//event
public static SetTextValue setTextValue;
public static void setValue( object value)
{
if (setTextValue != null)
{
setTextValue(value);
}
}
}
}
------解决方案--------------------
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 WindowsFormsApplication2
{
public partial class Form2 : Form
{
public static Form2 form2 = null;
public Form2()
{
InitializeComponent();
Broadcasting.setTextValue += new SetTextValue(setValue);
}
void setValue(object value)
{
label1.Text = value.ToString();
}
public static Form2 showfrom()
{
if (form2 == null)
{
form2 = new Form2();
}
return form2;
}
}
}
------解决方案--------------------