C#中窗体间传递数据的几种方法

在编写C#windows应用程序的时候我们经常会遇到这种问题,怎么样在两个窗体间传递数据呢?以下是我整理的网上的各种方法,在遇到一个实际问题:在form1中打开一个form2窗口作为录入界面,将录入的值经转换后在form1中显示。 采用了委托的方法,可以实现。(与VC的回调的应用相似)
1.可以通过委托的方法来解决
问题:通过form1做一个录入界面,将里边通过文本框录入的数值复值给 form2中的listview各列,用3个textbox1.text举例吧,分别对应listview的3个列。
可以这么做,如果两个窗体是在同一个命名空间下
定义一个代理,注意这个代理是全局的:(即同一命名空间下,与Form1,Form2平级的)
public delegate void MyInvoke(string Item1,string Item2,string Item3);

//在窗体From2中有这么一个回调函数,用于在ListView里添加一个新项的:
private void UpdateListView(string Item1,string Item2,string Item3)
{
ListView1.Items.Add(Item1);
ListView1.Items[ListView1.Items.Count - 1].SubItems.Add(Item2);
ListView1.Items[ListView1.Items.Count - 1].SubItems.Add(Item3);
}

//比如说点击Form2的一个按钮弹出Form1进行录入,在点击按钮的事件下:
//把委托传过去
Form1 frmEdit=new Form1(new MyInvoke(UpdateListView));
frmEdit.ShowDialog(this);

//在Form1里定义一个属性
private MyInvoke mi=null;

在构造函数中接收这个委托:
public Form1(MyInvoke myInvoke)
{
this.mi=myInvoke;
}

//录入数据后,点击OK按钮,在点击事件下:
//回调
this.mi(this.TextBox1.Text,this.TextBox3.Text,this.TextBox3.Text);
this.Close();//关闭Form1
补充:如果我要是想再把form2的值给form1,
Form1 frmEdit=new Form1(new MyInvoke(UpdateListView),string para1,string para2…);
frmEdit.ShowDialog(this);
然后将Form1的构造函数改成可以接收几个参数的就行了。

2.假如主框架为Form1,打开的搜索对话框是Form2.直接在Form2类中申明一个Form1实例:Form1 f1=new Form1();然后就可以通过f1来调用Form1中的域和函数了。其实不是这样的,你申明的新的Form1实例不是原来的那个Form1对象了,这样操作的是新的Form1中的域和函数,和最先打开的Form1是没有关系的。
我们要做的是把当前的Form1实例传递给Form2,如果是这样的话,问题就很好解决了。
方法1:首先,我们在Form2中定义:
private Form1 mF_Form
我们更改Form2的构造函数为有参数的
public Form2 ( Form1 myForm )
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent ( ) ;
this.mF_Form = myForm ; /这样在Form1中申明Form2的时候就把Form1的实例传递过来了
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
在Form1中,我在 要用到Form2的地方申明如下:
Form2 f2=new Form2(this);这里的this指的就是Form1当前的实例,也就是把当前Form1的实例通过Form2的构造函数传递给Form2类(其实在网上看到过比较蠢的方式,就是在构造函数里面传递要传递的信息如:字符串或是数字等,这样做很有局限性,不能传递其他的,所有我们可以直接传递实例,来完成传递更多的信息。)
这样在Form2中使用myForm 就可以对原来的Form1窗口进行操作了。但是你要把要操作的Form1中的域和函数定义成public形式的(这样可能不安全),此时的myForm就是真正的最开始打开的Form1了,你可以用这个实例来进行两个窗体的通讯了。 ()
3.其实C#中提供了窗体间进行通讯的现成的属性,呵呵,我们能想到的,微软也想到了,他们创造的语言其实确实可以说是人性化了。
在Form1类中申明Form2时用如下代码:
Form2 f2=new Form2();//类Form2中的构造函数不改,还是无参的
f2.owner=this;这里的this指的是类Form1当前的实例。
//也可以使用函数的方法,给当前实例添加一个附属窗口 代码:this.AddOwnedForm(f2);
在Form2类的定义中写如下代码:
Form1 f1=this.owner;
这样f1对应的就是原来的Form1的实例了,也就可以用这个进行通讯了。但是还是要把不同类之间访问的域和函数定义成public,哎,安全确实是一个问题!!

4.使用静态类
这个也是我们经常要用到的一种数据交互方法。
下面是定义的一个类:
using System;
using System.Collections;
namespace ZZ
{
public class AppDatas
{
private static ArrayList listData;
static AppDatas()
{
listData = new ArrayList();
listData.Add(“DotNet”);
listData.Add(“C#”);
listData.Add(“Asp.net”);
listData.Add(“WebService”);
listData.Add(“XML”);
}
public static ArrayList ListData
{
get{return listData;}
}
public static ArrayList GetListData()
{
return listData;
}
}
}
上面包含了一个静态类成员,listData,一个静态构造函数static AppDatas(),用来初始化listData的数据。还有一个静态属性ListData和一个静态GetListData()方法,他们实现了同样的功能就是返回listData。
由于前面两篇文章已经讲了很多,这里不细说了,下面是完整的代码:
Form1.cs文件
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace ZZ
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button buttonEdit;
private System.Windows.Forms.ListBox listBoxFrm1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
this.listBoxFrm1.DataSource = AppDatas.ListData;

     }protected override void Dispose( bool disposing ){if( disposing )if(components != null)components.Dispose();base.Dispose( disposing );}[STAThread]static void Main() {Application.Run(new Form1());}private void InitializeComponent(){this.buttonEdit = new System.Windows.Forms.Button();this.listBoxFrm1 = new System.Windows.Forms.ListBox();this.SuspendLayout();this.buttonEdit.Location = new System.Drawing.Point(128, 108);this.buttonEdit.Name = "buttonEdit";this.buttonEdit.TabIndex = 1;this.buttonEdit.Text = "修改";this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);this.listBoxFrm1.ItemHeight = 12;this.listBoxFrm1.Location = new System.Drawing.Point(12, 8);this.listBoxFrm1.Name = "listBoxFrm1";this.listBoxFrm1.Size = new System.Drawing.Size(108, 124);this.listBoxFrm1.TabIndex = 2;this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);this.ClientSize = new System.Drawing.Size(208, 141);this.Controls.Add(this.listBoxFrm1);this.Controls.Add(this.buttonEdit);this.Name = "Form1";this.Text = "Form1";this.ResumeLayout(false);}private void buttonEdit_Click(object sender, System.EventArgs e){Form2 formChild = new Form2();formChild.ShowDialog();this.listBoxFrm1.DataSource = null;this.listBoxFrm1.DataSource = AppDatas.ListData;}}

}

Form2.cs文件
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace ZZ
{
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button buttonOK;
private System.ComponentModel.Container components = null;
private System.Windows.Forms.ListBox listBoxFrm2;
private System.Windows.Forms.Button buttonAdd;
private System.Windows.Forms.Button buttonDel;
private System.Windows.Forms.TextBox textBoxAdd;
public Form2()
{
InitializeComponent();
foreach(object o in AppDatas.ListData)
this.listBoxFrm2.Items.Add(o);
}
protected override void Dispose( bool disposing )
{
if( disposing )
if(components != null)
components.Dispose();
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.buttonOK = new System.Windows.Forms.Button();
this.listBoxFrm2 = new System.Windows.Forms.ListBox();
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonDel = new System.Windows.Forms.Button();
this.textBoxAdd = new System.Windows.Forms.TextBox();
this.SuspendLayout();
this.buttonOK.Location = new System.Drawing.Point(188, 108);
this.buttonOK.Name = “buttonOK”;
this.buttonOK.TabIndex = 0;
this.buttonOK.Text = “确定”;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
this.listBoxFrm2.ItemHeight = 12;
this.listBoxFrm2.Location = new System.Drawing.Point(8, 8);
this.listBoxFrm2.Name = “listBoxFrm2”;
this.listBoxFrm2.Size = new System.Drawing.Size(168, 124);
this.listBoxFrm2.TabIndex = 2;
this.buttonAdd.Location = new System.Drawing.Point(188, 44);
this.buttonAdd.Name = “buttonAdd”;
this.buttonAdd.TabIndex = 3;
this.buttonAdd.Text = “增加”;
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
this.buttonDel.Location = new System.Drawing.Point(188, 76);
this.buttonDel.Name = “buttonDel”;
this.buttonDel.TabIndex = 4;
this.buttonDel.Text = “删除”;
this.buttonDel.Click += new System.EventHandler(this.buttonDel_Click);
this.textBoxAdd.Location = new System.Drawing.Point(188, 12);
this.textBoxAdd.Name = “textBoxAdd”;
this.textBoxAdd.Size = new System.Drawing.Size(76, 21);
this.textBoxAdd.TabIndex = 5;
this.textBoxAdd.Text = “”;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(272, 141);
this.Controls.Add(this.textBoxAdd);
this.Controls.Add(this.buttonDel);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.listBoxFrm2);
this.Controls.Add(this.buttonOK);
this.Name = “Form2”;
this.Text = “Form2”;
this.ResumeLayout(false);
}
private void buttonOK_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void buttonAdd_Click(object sender, System.EventArgs e)
{
if(this.textBoxAdd.Text.Trim().Length>0)
{
AppDatas.ListData.Add(this.textBoxAdd.Text.Trim());
this.listBoxFrm2.Items.Add(this.textBoxAdd.Text.Trim());
}
else
MessageBox.Show(“请输入添加的内容!”);

     }private void buttonDel_Click(object sender, System.EventArgs e){int index = this.listBoxFrm2.SelectedIndex;if(index!=-1){AppDatas.ListData.RemoveAt(index);this.listBoxFrm2.Items.RemoveAt(index);}elseMessageBox.Show("请选择删除项!");}}

}
总结,我认为使用静态类比较多的地方就是把应用程序的配置文件装载到一个静态类里面,让所有的窗体和其他实例都可以通过静态属性以及静态方法使用这些数据,比如三层结构或多层结构都可以访问它,而不是在多个实例间传来传去。在这里我们讨论的是Windows窗体,其实在两个不同的实例间交互数据,都可以采用三篇文章中的方案实现,除非是这个类特有的属性或着方法。现在都讲完了,虽然不是什么高深的东西,但是希望能对一些初学者有所帮助,同时也欢迎各位朋友进行技术交流,共同提高。

分析上面几种方法:
1. 采用了委托的方法,可以实现。:很好的实现了数据处理与数据显示的分离,即FORM2(主)显示与FORM1数据处理,(不需要将FORM2的显示放在FORM1中)与VC的回调的应用有延续性。并且确保了FORM1中要修改的属性的私有性。

2. 方法2、3都是传递主窗口的引用,比较简单易用。可以实现FORM2(主)与FORM1所有数据的传递(不过需要将要FORM1传递和要修改的数据设为PUBLIC),而这样会存在安全问题。

委托方法可以很好地实现数据的保护

总结C#中窗体间传递数据的几种方法 (由别人的方法整理)

在编写C#windows应用程序的时候我们经常会遇到这种问题,怎么样在两个窗体间传递数据呢?以下是我整理的网上的各种方法,在遇到一个实际问题:在form1中打开一个form2窗口作为录入界面,将录入的值经转换后在form1中显示。 采用了委托的方法,可以实现。(与VC的回调的应用相似)
1.可以通过委托的方法来解决
问题:通过form1做一个录入界面,将里边通过文本框录入的数值复值给 form2中的listview各列,用3个textbox1.text举例吧,分别对应listview的3个列。
可以这么做,如果两个窗体是在同一个命名空间下
定义一个代理,注意这个代理是全局的:(即同一命名空间下,与Form1,Form2平级的)
public delegate void MyInvoke(string Item1,string Item2,string Item3);

//在窗体From2中有这么一个回调函数,用于在ListView里添加一个新项的:
private void UpdateListView(string Item1,string Item2,string Item3)
{
ListView1.Items.Add(Item1);
ListView1.Items[ListView1.Items.Count - 1].SubItems.Add(Item2);
ListView1.Items[ListView1.Items.Count - 1].SubItems.Add(Item3);
}

//比如说点击Form2的一个按钮弹出Form1进行录入,在点击按钮的事件下:
//把委托传过去
Form1 frmEdit=new Form1(new MyInvoke(UpdateListView));
frmEdit.ShowDialog(this);

//在Form1里定义一个属性
private MyInvoke mi=null;

在构造函数中接收这个委托:
public Form1(MyInvoke myInvoke)
{
this.mi=myInvoke;
}

//录入数据后,点击OK按钮,在点击事件下:
//回调
this.mi(this.TextBox1.Text,this.TextBox3.Text,this.TextBox3.Text);
this.Close();//关闭Form1
补充:如果我要是想再把form2的值给form1,
Form1 frmEdit=new Form1(new MyInvoke(UpdateListView),string para1,string para2…);
frmEdit.ShowDialog(this);
然后将Form1的构造函数改成可以接收几个参数的就行了。

2.假如主框架为Form1,打开的搜索对话框是Form2.直接在Form2类中申明一个Form1实例:Form1 f1=new Form1();然后就可以通过f1来调用Form1中的域和函数了。其实不是这样的,你申明的新的Form1实例不是原来的那个Form1对象了,这样操作的是新的Form1中的域和函数,和最先打开的Form1是没有关系的。
我们要做的是把当前的Form1实例传递给Form2,如果是这样的话,问题就很好解决了。
方法1:首先,我们在Form2中定义:
private Form1 mF_Form
我们更改Form2的构造函数为有参数的
public Form2 ( Form1 myForm )
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent ( ) ;
this.mF_Form = myForm ; /这样在Form1中申明Form2的时候就把Form1的实例传递过来了
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
在Form1中,我在 要用到Form2的地方申明如下:
Form2 f2=new Form2(this);这里的this指的就是Form1当前的实例,也就是把当前Form1的实例通过Form2的构造函数传递给Form2类(其实在网上看到过比较蠢的方式,就是在构造函数里面传递要传递的信息如:字符串或是数字等,这样做很有局限性,不能传递其他的,所有我们可以直接传递实例,来完成传递更多的信息。)
这样在Form2中使用myForm 就可以对原来的Form1窗口进行操作了。但是你要把要操作的Form1中的域和函数定义成public形式的(这样可能不安全),此时的myForm就是真正的最开始打开的Form1了,你可以用这个实例来进行两个窗体的通讯了。 ()
3.其实C#中提供了窗体间进行通讯的现成的属性,呵呵,我们能想到的,微软也想到了,他们创造的语言其实确实可以说是人性化了。
在Form1类中申明Form2时用如下代码:
Form2 f2=new Form2();//类Form2中的构造函数不改,还是无参的
f2.owner=this;这里的this指的是类Form1当前的实例。
//也可以使用函数的方法,给当前实例添加一个附属窗口 代码:this.AddOwnedForm(f2);
在Form2类的定义中写如下代码:
Form1 f1=this.owner;
这样f1对应的就是原来的Form1的实例了,也就可以用这个进行通讯了。但是还是要把不同类之间访问的域和函数定义成public,哎,安全确实是一个问题!!

4.使用静态类
这个也是我们经常要用到的一种数据交互方法。
下面是定义的一个类:
using System;
using System.Collections;
namespace ZZ
{
public class AppDatas
{
private static ArrayList listData;
static AppDatas()
{
listData = new ArrayList();
listData.Add(“DotNet”);
listData.Add(“C#”);
listData.Add(“Asp.net”);
listData.Add(“WebService”);
listData.Add(“XML”);
}
public static ArrayList ListData
{
get{return listData;}
}
public static ArrayList GetListData()
{
return listData;
}
}
}
上面包含了一个静态类成员,listData,一个静态构造函数static AppDatas(),用来初始化listData的数据。还有一个静态属性ListData和一个静态GetListData()方法,他们实现了同样的功能就是返回listData。
由于前面两篇文章已经讲了很多,这里不细说了,下面是完整的代码:
Form1.cs文件
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace ZZ
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button buttonEdit;
private System.Windows.Forms.ListBox listBoxFrm1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
this.listBoxFrm1.DataSource = AppDatas.ListData;

     }protected override void Dispose( bool disposing ){if( disposing )if(components != null)components.Dispose();base.Dispose( disposing );}[STAThread]static void Main() {Application.Run(new Form1());}private void InitializeComponent(){this.buttonEdit = new System.Windows.Forms.Button();this.listBoxFrm1 = new System.Windows.Forms.ListBox();this.SuspendLayout();this.buttonEdit.Location = new System.Drawing.Point(128, 108);this.buttonEdit.Name = "buttonEdit";this.buttonEdit.TabIndex = 1;this.buttonEdit.Text = "修改";this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);this.listBoxFrm1.ItemHeight = 12;this.listBoxFrm1.Location = new System.Drawing.Point(12, 8);this.listBoxFrm1.Name = "listBoxFrm1";this.listBoxFrm1.Size = new System.Drawing.Size(108, 124);this.listBoxFrm1.TabIndex = 2;this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);this.ClientSize = new System.Drawing.Size(208, 141);this.Controls.Add(this.listBoxFrm1);this.Controls.Add(this.buttonEdit);this.Name = "Form1";this.Text = "Form1";this.ResumeLayout(false);}private void buttonEdit_Click(object sender, System.EventArgs e){Form2 formChild = new Form2();formChild.ShowDialog();this.listBoxFrm1.DataSource = null;this.listBoxFrm1.DataSource = AppDatas.ListData;}}

}

Form2.cs文件
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace ZZ
{
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button buttonOK;
private System.ComponentModel.Container components = null;
private System.Windows.Forms.ListBox listBoxFrm2;
private System.Windows.Forms.Button buttonAdd;
private System.Windows.Forms.Button buttonDel;
private System.Windows.Forms.TextBox textBoxAdd;
public Form2()
{
InitializeComponent();
foreach(object o in AppDatas.ListData)
this.listBoxFrm2.Items.Add(o);
}
protected override void Dispose( bool disposing )
{
if( disposing )
if(components != null)
components.Dispose();
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.buttonOK = new System.Windows.Forms.Button();
this.listBoxFrm2 = new System.Windows.Forms.ListBox();
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonDel = new System.Windows.Forms.Button();
this.textBoxAdd = new System.Windows.Forms.TextBox();
this.SuspendLayout();
this.buttonOK.Location = new System.Drawing.Point(188, 108);
this.buttonOK.Name = “buttonOK”;
this.buttonOK.TabIndex = 0;
this.buttonOK.Text = “确定”;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
this.listBoxFrm2.ItemHeight = 12;
this.listBoxFrm2.Location = new System.Drawing.Point(8, 8);
this.listBoxFrm2.Name = “listBoxFrm2”;
this.listBoxFrm2.Size = new System.Drawing.Size(168, 124);
this.listBoxFrm2.TabIndex = 2;
this.buttonAdd.Location = new System.Drawing.Point(188, 44);
this.buttonAdd.Name = “buttonAdd”;
this.buttonAdd.TabIndex = 3;
this.buttonAdd.Text = “增加”;
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
this.buttonDel.Location = new System.Drawing.Point(188, 76);
this.buttonDel.Name = “buttonDel”;
this.buttonDel.TabIndex = 4;
this.buttonDel.Text = “删除”;
this.buttonDel.Click += new System.EventHandler(this.buttonDel_Click);
this.textBoxAdd.Location = new System.Drawing.Point(188, 12);
this.textBoxAdd.Name = “textBoxAdd”;
this.textBoxAdd.Size = new System.Drawing.Size(76, 21);
this.textBoxAdd.TabIndex = 5;
this.textBoxAdd.Text = “”;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(272, 141);
this.Controls.Add(this.textBoxAdd);
this.Controls.Add(this.buttonDel);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.listBoxFrm2);
this.Controls.Add(this.buttonOK);
this.Name = “Form2”;
this.Text = “Form2”;
this.ResumeLayout(false);
}
private void buttonOK_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void buttonAdd_Click(object sender, System.EventArgs e)
{
if(this.textBoxAdd.Text.Trim().Length>0)
{
AppDatas.ListData.Add(this.textBoxAdd.Text.Trim());
this.listBoxFrm2.Items.Add(this.textBoxAdd.Text.Trim());
}
else
MessageBox.Show(“请输入添加的内容!”);

     }private void buttonDel_Click(object sender, System.EventArgs e){int index = this.listBoxFrm2.SelectedIndex;if(index!=-1){AppDatas.ListData.RemoveAt(index);this.listBoxFrm2.Items.RemoveAt(index);}elseMessageBox.Show("请选择删除项!");}}

}
总结,我认为使用静态类比较多的地方就是把应用程序的配置文件装载到一个静态类里面,让所有的窗体和其他实例都可以通过静态属性以及静态方法使用这些数据,比如三层结构或多层结构都可以访问它,而不是在多个实例间传来传去。在这里我们讨论的是Windows窗体,其实在两个不同的实例间交互数据,都可以采用三篇文章中的方案实现,除非是这个类特有的属性或着方法。现在都讲完了,虽然不是什么高深的东西,但是希望能对一些初学者有所帮助,同时也欢迎各位朋友进行技术交流,共同提高。

分析上面几种方法:
1. 采用了委托的方法,可以实现。:很好的实现了数据处理与数据显示的分离,即FORM2(主)显示与FORM1数据处理,(不需要将FORM2的显示放在FORM1中)与VC的回调的应用有延续性。并且确保了FORM1中要修改的属性的私有性。

2. 方法2、3都是传递主窗口的引用,比较简单易用。可以实现FORM2(主)与FORM1所有数据的传递(不过需要将要FORM1传递和要修改的数据设为PUBLIC),而这样会存在安全问题。

委托方法可以很好地实现数据的保护

C#中窗体间传递数据的几种方法相关推荐

  1. 总结C#中窗体间传递数据的几种方法

    在编写C#windows应用程序的时候我们经常会遇到这种问题,怎么样在两个窗体间传递数据呢?以下是我整理的网上的各种方法,在遇到一个实际问题:在form1中打开一个form2窗口作为录入界面,将录入的 ...

  2. 窗体之间传递值的几种方法

    窗体之间传递值的几种方法 场景如下: 我有一个mainFrm(父窗体), 一个subFrm(子窗体) 点击父窗体的按钮启动子窗体,点击子窗体的按钮可以给父窗体设置值.如下图 第一种方法:启动子窗体,将 ...

  3. Linux中进程间传递文件描述符的方法

    在进行fork调用后,由于子进程会拷贝父进程的资源,所以父进程中打开的文件描述符在子进程中仍然保持着打开,我们很容易的就将父进程的描述符传递给了子进程.但是除了这种情况下,如果想将某个父进程在子进程创 ...

  4. VC++中进程间相互通信的十一种方法

    进程通常被定义为一个正在运行的程序的实例,它由两个部分组成: 一个是 操作系统用来管理进程的内核对象.内核对象也是系统用来存放关于进程的统计信息的地方 另一个是地址空间,它包含所有的可执行模块或DLL ...

  5. Vue 组件之间传值(传递数据)的5种方法 (七)

    文章目录 一.父传子(父组件向子组件传递数据) 二.子传父(子组件向父组件中传递数据) 三.兄弟组件之间的传值 四.总线传值 五.通过Vuex这个仓库,进行数据交互(后面会讲) 一.父传子(父组件向子 ...

  6. arcgis分隔图层重复出文件_已知坐标点txt文件在ArcGIS中转换成shp数据的两种方法...

    在平时工作中,经常会遇到只有txt坐标的勘测定界图等数据,通过以下操作步骤可将txt数据转换成shp数据. 方法一 1.打开txt数据,如下图所示,该数据为面数据,坐标系为西安80,投影方式是3度分带 ...

  7. Excel中反转一列数据的几种方法

    转载自:http://www.excel123.cn/Article/exceljichu/200911/514.html 假如在Excel表格的A列中有10行数据,现在要把第10行数据放在第一行,第 ...

  8. react-native页面间传递数据的几种方式

    1. 利用react-native 事件DeviceEventEmitter 监听广播 应用场景: - 表单提交页面, A页面跳转到B页面选人, 然后返回A页面, 需要将B页面选择的数据传回A页面. ...

  9. oracle删除表中数据_Excel工作表中,删除重复数据的2种方法解读,高效且实用!...

    在实际的工作中,经常要对工作表中重复的数据进行删除,如若数据行只有几条,则可通过人工查找出来,如若数据行较多,这种方法就费时费力,而且容易出错,造成对表格数据的准确性和个人能力的怀疑--今天,小编给大 ...

最新文章

  1. 2022-2028年中国六氟化硫行业市场研究及前瞻分析报告
  2. (Question)CSS中position的绝对定位问题
  3. oracle修改memory,Oracle 修改 MEMORY_TARGET
  4. Webpack安装、打包过程及开发过程超详细教程(专治看不懂学不会)
  5. 从东岳流体下载自带OpenFOAM的Vmware虚拟机(Ubuntu20.04+OpenFOAM),无法共享文件夹【终极解决方案】
  6. 计算机整个文稿应用回顾主题,《计算机应用基础》精品课程电子教案-PowerPoint 2003...
  7. php的old函数,laravel单元测试之phpUnit中old()函数报错解决
  8. 【追寻javascript高手之路05】理解事件流
  9. spring mvc controller间跳转 重定向 传参 (转)
  10. 推荐几个火狐浏览器插件
  11. gulp打包报错 “Error: Unhandled ‘error‘ event at new JS_Parse_Error”
  12. IDEA 使用 hibernate
  13. window上vs2017 opencv图片路径问题(附3种加载路径方法)
  14. 续航超1000km,极氪成为宁德时代麒麟电池全球量产首发品牌 | 美通社头条
  15. android平板电脑的虚拟键盘,win10平板电脑不弹出虚拟键盘的两种解决方法
  16. static静态变量 与 常量
  17. 李永乐团队2021数学基础过关660题勘误表
  18. 第五章 阻抗匹配与调谐 Smith圆图
  19. HQL和Criteria
  20. 开源OLAP系统的比较:ClickHouse、Druid和Pinot

热门文章

  1. weblogic的安装与部
  2. flac格式如何转mp3,3招帮你搞定
  3. Google | Google Kubernetes Engine 集群实战
  4. 国产FPGA厂商及产品
  5. .net基础学java系列(五)慢性自杀 之 沉沦在IDE中
  6. linux:用户修改密码方法
  7. Maven下载安装及使用
  8. 2019年 团体程序设计天梯赛——题解集
  9. 什么是模块化?为什么要模块化
  10. ubuntu命令行查看dns_Ubuntu命令行网络配置