这个你需要传参数了。。呵呵 form1using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;using System.Data.SqlClient; namespace test { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) {
} private void button1_Click_1(object sender, EventArgs e) { Form2 f = new Form2(this); f.ShowDialog(); } } }
form2----把from1的label的modifiers设置成public 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 test { public partial class Form2 : Form {
form1using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;using System.Data.SqlClient;
namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
} private void button1_Click_1(object sender, EventArgs e)
{
Form2 f = new Form2(this);
f.ShowDialog();
}
}
}
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 test
{
public partial class Form2 : Form
{
Form1 f1;
public Form2(Form1 f1)
{
this.f1 = f1;
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
f1.label1.Text = "更新成功";
this.Hide();
}
}
}
delegate... event
的后面 执行以下加载datagridview事件就行了