我的主窗口, 在进行初始化时希望 弹出一个子窗口, 提示“系统正在初始化”,子窗口已经弹出,在子窗口上的那个 Label 控件的 Text 没有显示在子窗口上,简要代码如下:主窗口:
Connect  connect = new Connect();
connect.Show();
UserLogin(); // 连接数据库,进行用户和密码的校验
// connect.label1.Show ();
connect.Close();子窗口:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;namespace Ch18Ex02
{
/// <summary>
/// Connect 的摘要说明。
/// </summary>
public class Connect : System.Windows.Forms.Form
{
public  System.Windows.Forms.Label label1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Connect()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
// 
// label1
// 
this.label1.Location = new System.Drawing.Point(48, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(168, 23);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
// 
// Connect
// 
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(313, 37);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
  this.label1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Location = new System.Drawing.Point(400, 300);
this.MaximumSize = new System.Drawing.Size(321, 64);
this.MinimumSize = new System.Drawing.Size(321, 64);
this.Name = "Connect";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Connect";
this.Load += new System.EventHandler(this.Connect_Load);
this.ResumeLayout(false); }
#endregion private void Connect_Load(object sender, System.EventArgs e)
{

}
}
}