Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Loading form ...
 

Loading form ...

Dear friends,

I have a form that takes a while to load because it's reading a few entries from a text file. I created a very small form with a loading gif inside so that before the slow form to load, the loading form is first loaded showing the loading gif. And at the end of the slow form load, this one changes a variable in the loading form that has a timer checking for that value, if the value is changed it means that the slow form is fully loaded and the loading form is closed. Take a look at the code:

AppMain.loading nl = new CRMOS.AppMain.loading();
nl.Show(); //loading form is showned

AppBase.moedas fdx = new CRMOS.AppBase.moedas();
fdx.TopLevel = false;
fdx.Visible = true;
splitContainer1.Panel2.Controls.Remove(panel2Form);
nl.sair = true; //when the slow form is loaded, it changes the variable in the loading form
So, this works fine and the loading form is loaded .. the only problem is that the loading form freezes until the slow form is fully loaded .. i can see the loading form windows, but the gif's and the labels inside are not shown ..

Can anyone please help me!

Thanks in advance.



FireScroll  Monday, September 14, 2009 3:32 PM
Ok,
I've found it.
Using a thread:

System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
t.Start();

AppBase.moedas fdx = new CRMOS.AppBase.moedas();
fdx.TopLevel = false;
fdx.Visible = true;
this.AbrirNoPanel2(fdx);
t.Abort();

public static void ThreadProc()
{
      Application.Run(new AppMain.loading());
}




Works just fine.
Thanks to all! :)


  • Marked As Answer byFireScroll Monday, September 14, 2009 5:40 PM
  •  
FireScroll  Monday, September 14, 2009 5:40 PM
Ok,
I've found it.
Using a thread:

System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
t.Start();

AppBase.moedas fdx = new CRMOS.AppBase.moedas();
fdx.TopLevel = false;
fdx.Visible = true;
this.AbrirNoPanel2(fdx);
t.Abort();

public static void ThreadProc()
{
      Application.Run(new AppMain.loading());
}




Works just fine.
Thanks to all! :)


  • Marked As Answer byFireScroll Monday, September 14, 2009 5:40 PM
  •  
FireScroll  Monday, September 14, 2009 5:40 PM

You can use google to search for other answers

Custom Search

More Threads

• Advice Appreciated : Building new Control Similar to TabControl
• General questions Behaviors
• Dynamic Property
• Validating Fields
• confussion into how to put progress bar into my project
• Writing Data From XML to Excel
• The variable 'BranchStyle' is either undelcared or was never assigned
• unknown message in visual studios (C# programing)
• Generating dynamic columns on a designer generated DataGridView control
• Bug found in Visual Studio 2008's Form Designer