再Form1中加入一個全局變量, 點擊Form2的確定後先對Form1的那個全局變量進行賦值,在Form1中的那個需要傳遞的參數就用這個全局變量來代替,不就好了,不過耗時線程建議不要放在Form中
解决方案 »
- 哪位大哥能看懂网页源码,帮忙看看这段里哪ID是输入框啊??帮帮忙吧,是C#操作网页的,webbrowser
- 无法启动Windows服务的问题
- 一个dataGridView极度复杂的问韪.......................................
- 在DirectX 9.0例子中的文件DXMUT.cs的名字中的MUT是什么的缩写呀?
- 求助 为什么我用c#编的程序在运行的情况下有时候会突然自动关闭
- 为了提高传输邮件的性能,想用异步传输的方式,请问该怎么做啊
- 能讲讲什么叫.net技术,该如何学习啊
- 请问如何在C#中拷贝控件?
- 我要做一个全新的WebService项目,请大家来讨论一下!
- 下载了一段代码,执行后出现以下错误,不知如何解决
- FORM控件如何刷新显示呀?
- 程序"F:\csharp\windowsapplication1\obj|debug\windowsapplication1.exe"未定義入口點
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(80, 80);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 0;
this.textBox1.Text = "textBox1";
//
// button1
//
this.button1.Location = new System.Drawing.Point(88, 136);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// frmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Name = "frmMain";
this.Text = "Form1";
this.ResumeLayout(false);
me.OnMessage += new frmNext.Message(this.txtMessage); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new frmMain());
} private void txtMessage(string str)
{
this.textBox1.Text = str;
} private void button1_Click(object sender, System.EventArgs e)
{
me.writeMessage("hello from main");
me.Show();
} }
以上为Form1 private void button1_Click(object sender, System.EventArgs e)
{
this.OnMessage("Hello");
}
public void writeMessage(string str)
{
this.textBox1.Text = str;
} private void frmNext_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;;
this.Hide();
}
//form2
public class WorkThread
{
//下面定義一些變量
public int nPort = -1;
public WorkThread()
{
}
//下面是工作函數
public void Work()
{
//Some work code
}
}//下面是調用
WorkThread oWork = new WorkThread();
oWork = 10;
Thread t = new Thread(new ThreadStart(oWork.Work)
t.IsBackGround = true;
t.Start();這樣在Work函數要耗掉很多CPU時間的情況下,你的主程序介面刷新也不會受到影響
没看懂!还请指教!