2012-03-19 61 views
0

當應用程序啓動時我做它的網絡實時檢查,它會顯示一個形式,而稍微等待一段時間,這是這裏缺少文字標籤,當應用程序啓動

enter image description here

但是,當我編譯和運行它的形式懷念的文本標籤

enter image description here

[STAThread] 
static void Main() 
    { 
     Application.EnableVisualStyles(); 
     Application.SetCompatibleTextRenderingDefault(false); 

     Connecting c = new Connecting();//This is the waiting form 

     c.Show(); 

     if (UsefulClass.Ping("www.google.com") == false) { 
      c.Close(); 
      return; 
     } 

     frmV38 login = new frmV38(); 

     if (login.ShowDialog() == DialogResult.OK) 
     { 
      login.Close(); 
      Application.Run(new frmMain()); 
     } 
     else { 
      Application.Exit(); 
     } 
    } 

Connecting.cs

public partial class Connecting : Form 
    { 
     public Connecting() 
     { 
      InitializeComponent(); 
     } 

     private void Connecting_Load(object sender, EventArgs e) 
     { 

     } 
    } 

謝謝

+0

哪裏是_Application.Run(新連接()); _? – Coder 2012-03-19 08:20:37

+0

你是否缺少InitializeComponent()?在連接窗體的構造函數中? – BreakHead 2012-03-19 08:23:17

回答

0

可以嘗試

Application.DoEvents(); 

c.Show(); 
+0

謝謝!它很好,但我認爲它是DoEvents()而不是DoEvent()。 – jean 2012-03-19 08:48:23

+0

Yah。我從我的記憶中寫下來。 – PraveenVenu 2012-03-19 08:49:57

0

是否缺少的InitializeComponent()?在連接窗體的構造函數中?

+0

我在Connecting.cs中編寫了InitializeComponent() – jean 2012-03-19 08:51:09