我试过在第一个窗体作一个按钮,点击按钮时,把第二个窗体设为第一个窗体所有,在第一个窗体关闭时可以更新第一个窗体。
private void button1_Click(object sender, EventArgs e)
{
frm_SupplierComp SupplierComp = new frm_SupplierComp();
SupplierComp.Owner = this; //指定新开窗口的所有者为当前窗口
SupplierComp.frmEnter.Text = "3";
SupplierComp.Show();}frm_repair f = (frm_repair)this.Owner;
f.UpdateComobox();
但我现在作的是第二个子窗体更改数据,第一个窗体是打开状态,第二个窗体不是点击第一个窗体的按钮打开的,不能用owner功能,如何才能作到第二个窗体更改数据后,第一个窗体的数据重新刷新?请老师指点一下,万份感谢。
private void button1_Click(object sender, EventArgs e)
{
frm_SupplierComp SupplierComp = new frm_SupplierComp();
SupplierComp.Owner = this; //指定新开窗口的所有者为当前窗口
SupplierComp.frmEnter.Text = "3";
SupplierComp.Show();}frm_repair f = (frm_repair)this.Owner;
f.UpdateComobox();
但我现在作的是第二个子窗体更改数据,第一个窗体是打开状态,第二个窗体不是点击第一个窗体的按钮打开的,不能用owner功能,如何才能作到第二个窗体更改数据后,第一个窗体的数据重新刷新?请老师指点一下,万份感谢。
解决方案 »
- 求解,c#转换到4.0报溢出错误。
- 如何判断DEMO的版本!!
- 在form里放一个定时器,当到了10(倒计时)秒时关闭Form,怎么显视这个时间
- 请问类似于.NET工具箱的那个滑动的效果怎么做的!!!!
- distinct与表的连接
- 想来日本工作的话,请联系
- 我只想通过WORD打开指定目录(如:d:\myfile\aa\xxx.doc)的文件,代码怎么写啊???
- 请问如何在程序启动的时间自动弹出IE-------winform??
- textBox中不填数据时显示0.00,填入数据后,按小数点右对齐,没有小数位则自动补.和两位小数00,整数部分每三位有分节号.如何实现?
- 关于NPOI的打印标题设置
- 求一个vs的快捷键
- 请问怎么这个XML怎么遍历?
http://topic.csdn.net/u/20100914/14/8701d0e9-c355-4dac-b428-493e535a0c4d.html
Form2 f2 = new Form2();
private void button1_Click(object sender, EventArgs e)
{
f2.MyA+= new Form2.AA(B);
f2.Show();
}
void B(string str){}public delegate void AA(string str);
public event AA MyA;
private void button1_Click(object sender, EventArgs e)
{
this.MyA();
}
//Form1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace TestShow
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public Form1(string str)
{
InitializeComponent();
this.label1.Text = str;
}
private void button2_Click(object sender, EventArgs e)
{
Form2 fr2 = new Form2();
fr2.Show();
this.Visible = false;
}
//=========================
//Form2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace TestShow
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 fr1 = new Form1(textBox1.Text);
fr1.Show();
this.Visible = false;
}
}
}