473,473 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Form.Show() not displaying Label. ShowDialog does.

Hi,

I created a blank Form with one Label, and the Label's text says
"Loading... Please wait.". I display this form in Main() with Show()
while i do some lengthy initialization stuff (ie loading files), but
the Label appears transparent! I can see through to my desktop where
the Label control is. But, if i display this form with ShowDialog(),
it displays the label fine. Am I missing something here?

Here is the code:
private static void Main()
{
LoadingForm lf = new LoadingForm();
lf.Show(); // The label doesn't get displayed!

// Do length, time consuming stuff ...

lf.Close();
}

But if i do this, the Label gets displayed fine:
private static void Main()
{
LoadingForm lf = new LoadingForm();
lf.ShowDialog(); // The label gets displayed fine!

// Do length, time consuming stuff ...
}

any ideas why this could be happening?

-alex-

Nov 17 '05 #1
5 10943
Hi,

Where are you calling Application.Run ?
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"AlexGray" <gr*****@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi,

I created a blank Form with one Label, and the Label's text says
"Loading... Please wait.". I display this form in Main() with Show()
while i do some lengthy initialization stuff (ie loading files), but
the Label appears transparent! I can see through to my desktop where
the Label control is. But, if i display this form with ShowDialog(),
it displays the label fine. Am I missing something here?

Here is the code:
private static void Main()
{
LoadingForm lf = new LoadingForm();
lf.Show(); // The label doesn't get displayed!

// Do length, time consuming stuff ...

lf.Close();
}

But if i do this, the Label gets displayed fine:
private static void Main()
{
LoadingForm lf = new LoadingForm();
lf.ShowDialog(); // The label gets displayed fine!

// Do length, time consuming stuff ...
}

any ideas why this could be happening?

-alex-

Nov 17 '05 #2
I'm not using Application.Run anywhere.
My "application" is just a ShowDialog() window. When that window is
closed, Main() terminates and the application closes.

ie ( I can reproduce it like this. I'm use Thread.Sleep to simulate a
bunch of loading time. I also noticed that both in my app and in this
demo below i can't move the "Loading" window. It's frozen and says
"Not Responding" if i try to click on it.):
using System.Threading;
public class InitializeGame
{
private static void Main()
{
Form1 ld = new Form1();
ld.Show();
Thread.Sleep(5000);
ld.Close();
}
}

I think you're getting to the bottom of this...

Nov 17 '05 #3
Ah. I figured it out. I ended up creating a new thread that launches
my "Loading... Please wait" form.
In the Loading form i added this code:
public new void Show()
{
Thread t = new Thread(new ThreadStart(ThreadProc));
t.Start();
}

public void ThreadProc()
{
Application.Run (new Loading() );
}
If you have any questions, feel free to ask :)
-alex-

Nov 17 '05 #4
Ah. I figured it out. I ended up creating a new thread that launches
my "Loading... Please wait" form.
In the Loading form i added this code:
public new void Show()
{
Thread t = new Thread(new ThreadStart(ThreadProc));
t.Start();
}

public void ThreadProc()
{
Application.Run (new Loading() );
}
If you have any questions, feel free to ask :)
-alex-

Nov 17 '05 #5
Hi,
"AlexGray" <gr*****@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I'm not using Application.Run anywhere.


You need it, It create the message loop and make the form visible

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mathieu Chavoutier | last post by:
Hi. I want to create a kind of configuration window. So, I have a main window, and when I click on a button, it opens a new form. But, because it is a configuration window, I would like that...
4
by: Paul Aspinall | last post by:
Can anyone advise how to display a form on top, and modal, without using ShowDialog?? Thanks
4
by: Jm | last post by:
Hi all Im not sure of the best way to be displaying my forms and just want a bit of clarification. Being only recently moved to vb.net im still used to the old vb6 form.show method, now under...
3
by: bsturg21 | last post by:
Hello, I have a windows form that has a series of linklabels on it, and I need to have each linklabel, when clicked, open a separate windows form that has a single paramter passed into it. The...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.