编写了一个实时收集数据并运算的A程序,此程序单独运行时完全正常,“调试”——“启动新实例”后运行2个A程序收集不同2个点的数据并运算也完全正常。然后我编写了另一个B程序调用A程序,用的方法如下:
using System.Reflection;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} public string fileName = @"D:\My Documents\Visual Studio 2005\Projects\test\test\bin\Debug\test.exe";
public string typeName = "test.Form1"; public Form LoadForm(string typeName, string fileName)
{
Assembly asm = Assembly.LoadFile(fileName);
Type frmType = asm.GetType(typeName, false, true);
if (frmType == null)
{
return null;
} Form frm = (Form)Activator.CreateInstance(frmType);
return frm;
}
private void button1_Click(object sender, EventArgs e)
{
try
{
Form frm = LoadForm(typeName, fileName);
frm.Show();
this.Hide();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}B程序没有其他另外的功能,只是设置了几个button按照上面的格式分别点击后可以调用其他不同的程序。但是通过点击2次B程序的button1调用2个A程序后,这2个A程序运行就不正常了。请问这个是怎么回事?怎么解决?谢谢
using System.Reflection;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} public string fileName = @"D:\My Documents\Visual Studio 2005\Projects\test\test\bin\Debug\test.exe";
public string typeName = "test.Form1"; public Form LoadForm(string typeName, string fileName)
{
Assembly asm = Assembly.LoadFile(fileName);
Type frmType = asm.GetType(typeName, false, true);
if (frmType == null)
{
return null;
} Form frm = (Form)Activator.CreateInstance(frmType);
return frm;
}
private void button1_Click(object sender, EventArgs e)
{
try
{
Form frm = LoadForm(typeName, fileName);
frm.Show();
this.Hide();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}B程序没有其他另外的功能,只是设置了几个button按照上面的格式分别点击后可以调用其他不同的程序。但是通过点击2次B程序的button1调用2个A程序后,这2个A程序运行就不正常了。请问这个是怎么回事?怎么解决?谢谢
我用本机的matlab里面的udp模块发送,n个模块就可以发送n个不同点的数据