473,779 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Thread

Uwe
Hello,
I have an application in which I want to show a loadscreen. (I'm loading
data from the WEB and as long the app load the data I show an animated
screen which says Loading Data. I used a thread for this. It works fine on a
machine where I have installed Visual Studio (2005 or 2008) as EXE or within
VS.

I run it o n a machine where Visual Studio is not installed it crashes when
I try to start the wait screen (after closing) a second time, or the
application crashed when I close it if I only strat the screen one times.

I got the typical DW20.exe error message.

Thats the code:
C#-Code:
Thread LoadThread = new Thread(new ThreadStart(Sho wLoadScreen));
LoadThread.IsBa ckground = true;
LoadThread.SetA partmentState(A partmentState.S TA);
LoadThread.Star t();

... Aktionen ...

LoadThread.Abor t();
fWait.Close();
ShowLoadScreen( )
{
fWait = new frmWait();
fWait.ShowDialo g();
fWait = null;
}

What may I do against ?

Thanks and regards
Uwe

Dec 5 '07 #1
7 1602
What you want to do is actually show the form on the UI thread, but then
perform the work on another thread. If you need to update the UI, you would
call Invoke from the background thread to update the UI.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Uwe" <ca*******@gmx. dewrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hello,
I have an application in which I want to show a loadscreen. (I'm loading
data from the WEB and as long the app load the data I show an animated
screen which says Loading Data. I used a thread for this. It works fine on
a machine where I have installed Visual Studio (2005 or 2008) as EXE or
within VS.

I run it o n a machine where Visual Studio is not installed it crashes
when I try to start the wait screen (after closing) a second time, or the
application crashed when I close it if I only strat the screen one times.

I got the typical DW20.exe error message.

Thats the code:
C#-Code:
Thread LoadThread = new Thread(new
ThreadStart(Sho wLoadScreen));
LoadThread.IsBa ckground = true;
LoadThread.SetA partmentState(A partmentState.S TA);
LoadThread.Star t();

... Aktionen ...

LoadThread.Abor t();
fWait.Close();
ShowLoadScreen( )
{
fWait = new frmWait();
fWait.ShowDialo g();
fWait = null;
}

What may I do against ?

Thanks and regards
Uwe

Dec 5 '07 #2
Hi,
You do not really need a thread, in this case you need a splash window.

The reason is that you cannot do nothing until the data is loaded (at least
that is inferred from your post).
You use a thread when you have a long lasting operation and you need the UI
to remain active.

Google splash window in this NG and you will get several post of how to do
it.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Uwe" <ca*******@gmx. dewrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hello,
I have an application in which I want to show a loadscreen. (I'm loading
data from the WEB and as long the app load the data I show an animated
screen which says Loading Data. I used a thread for this. It works fine on
a machine where I have installed Visual Studio (2005 or 2008) as EXE or
within VS.

I run it o n a machine where Visual Studio is not installed it crashes
when I try to start the wait screen (after closing) a second time, or the
application crashed when I close it if I only strat the screen one times.

I got the typical DW20.exe error message.

Thats the code:
C#-Code:
Thread LoadThread = new Thread(new
ThreadStart(Sho wLoadScreen));
LoadThread.IsBa ckground = true;
LoadThread.SetA partmentState(A partmentState.S TA);
LoadThread.Star t();

... Aktionen ...

LoadThread.Abor t();
fWait.Close();
ShowLoadScreen( )
{
fWait = new frmWait();
fWait.ShowDialo g();
fWait = null;
}

What may I do against ?

Thanks and regards
Uwe

Dec 5 '07 #3
Uwe
It's not really a Splash Screen. It's a wait screen during loading a grid.
Do you have any simple sample ?
Thanks and regards
Uwe

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comschrieb im
Newsbeitrag news:ev******** ******@TK2MSFTN GP03.phx.gbl...
Hi,
You do not really need a thread, in this case you need a splash window.

The reason is that you cannot do nothing until the data is loaded (at
least that is inferred from your post).
You use a thread when you have a long lasting operation and you need the
UI to remain active.

Google splash window in this NG and you will get several post of how to do
it.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Uwe" <ca*******@gmx. dewrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>Hello,
I have an application in which I want to show a loadscreen. (I'm loading
data from the WEB and as long the app load the data I show an animated
screen which says Loading Data. I used a thread for this. It works fine
on a machine where I have installed Visual Studio (2005 or 2008) as EXE
or within VS.

I run it o n a machine where Visual Studio is not installed it crashes
when I try to start the wait screen (after closing) a second time, or the
application crashed when I close it if I only strat the screen one times.

I got the typical DW20.exe error message.

Thats the code:
C#-Code:
Thread LoadThread = new Thread(new
ThreadStart(Sh owLoadScreen));
LoadThread.IsBa ckground = true;
LoadThread.SetA partmentState(A partmentState.S TA);
LoadThread.Star t();

... Aktionen ...

LoadThread.Abor t();
fWait.Close();
ShowLoadScreen( )
{
fWait = new frmWait();
fWait.ShowDialo g();
fWait = null;
}

What may I do against ?

Thanks and regards
Uwe

Dec 5 '07 #4
Uwe
Do you have any sample ?

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comschrieb im
Newsbeitrag news:ev******** ******@TK2MSFTN GP03.phx.gbl...
Hi,
You do not really need a thread, in this case you need a splash window.

The reason is that you cannot do nothing until the data is loaded (at
least that is inferred from your post).
You use a thread when you have a long lasting operation and you need the
UI to remain active.

Google splash window in this NG and you will get several post of how to do
it.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Uwe" <ca*******@gmx. dewrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>Hello,
I have an application in which I want to show a loadscreen. (I'm loading
data from the WEB and as long the app load the data I show an animated
screen which says Loading Data. I used a thread for this. It works fine
on a machine where I have installed Visual Studio (2005 or 2008) as EXE
or within VS.

I run it o n a machine where Visual Studio is not installed it crashes
when I try to start the wait screen (after closing) a second time, or the
application crashed when I close it if I only strat the screen one times.

I got the typical DW20.exe error message.

Thats the code:
C#-Code:
Thread LoadThread = new Thread(new
ThreadStart(Sh owLoadScreen));
LoadThread.IsBa ckground = true;
LoadThread.SetA partmentState(A partmentState.S TA);
LoadThread.Star t();

... Aktionen ...

LoadThread.Abor t();
fWait.Close();
ShowLoadScreen( )
{
fWait = new frmWait();
fWait.ShowDialo g();
fWait = null;
}

What may I do against ?

Thanks and regards
Uwe

Dec 5 '07 #5
Hi,
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Uwe" <ca*******@gmx. dewrote in message
news:fj******** *****@news.t-online.com...
It's not really a Splash Screen. It's a wait screen during loading a grid.
It's the same. A splash screen is used to present something visual to the
user until the program loads. That's precisely what you want to do.
Do you have any simple sample ?
This is a post I did a time ago, it was the third entry when searching:
splash window group:microsoft .public.dotnet. languages.cshar p

http://groups.google.com/group/micro...141a784871c790
Dec 5 '07 #6
Thanks Ignacio,
that works, but my problem is, that my wait screen is animated. Actually a
Macromedia Flash File. When the waitscreen is shown, the animation will not
shown but only a still picture.

Is there a way to solve ?

Thanks and regards
Uwe

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Uwe" <ca*******@gmx. dewrote in message
news:fj******** *****@news.t-online.com...
It's not really a Splash Screen. It's a wait screen during loading a grid.

It's the same. A splash screen is used to present something visual to the
user until the program loads. That's precisely what you want to do.
Do you have any simple sample ?

This is a post I did a time ago, it was the third entry when searching:
splash window group:microsoft .public.dotnet. languages.cshar p

http://groups.google.com/group/micro...141a784871c790
Dec 5 '07 #7
My suggestion is that, the problem can be better tackled if you call
fWait.Close(). In that case the dialog will be closed normally instead
of being aborted.

Also it's better to call ShowDialog() on UI thread and let other
thread to to the work. Then you don't have to use control.Invoke( ).
Dec 7 '07 #8

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

Similar topics

0
3502
by: David | last post by:
I've written a small windows service, and I'm having a problem that I'm spending a lot more time on than I'd like. If anyone has experienced this problem and has any hints or solutions; they would be appreciated. Simply leaving the threadMain() method if something unexpected occurs during thread execution leaves the thread in a ThreadState.Running state. This (apparently??) causes the Thread.Join() in service.OnStop() to hang...
2
1559
by: Andrew Rawnsley | last post by:
Downloaded the eRServer 1.2 source (thanks, guys) and installed, and am having a problem. Anyone else dug into this yet? Situation: PG 7.3.4 on linux (master) Its been tried with 3 slaves, all 7.3.4, 2 on OS X and one on Linux. It builds fine. It installs fine. I go through the setup with no problems (calling createlang, doing the initial ers_setup, adding
7
2705
by: Ivan | last post by:
Hi I have following problem: I'm creating two threads who are performing some tasks. When one thread finished I would like to restart her again (e.g. new job). Following example demonstrates that. Problem is that when program is started many threads are created (see output section), when only two should be running at any time. Can you please help me to identify me where the problem is? Best regards
4
6206
by: Madhu Gopinathan | last post by:
Hi All, I am faced with a horrible hang problem. I have a COM exe server that executes some tasks. The task execution manager is a thread that manages the pool of threads, which is 4 per processor. Each task is processed in a separate thread. Each of the executer threads is an STA thread, and it goes ahead and executes the task. No problems are encountered when tasks are executed one at a time, but when multiple tasks are executed...
0
2060
by: Shoveler | last post by:
I've got an odd problem here that I've been beating my head on for days. I've written a class that uses a pre-established connection for communication, meaning I can use this class for a server or a client. After receiving a Socket that has been connected to a RemoteEP, it begins 2 threads by calling out Begin(). My Send Thread pauses until the class Parent wants to send data. Receive Thread keeps checking for incoming data. My...
14
2942
by: Christian Kaiser | last post by:
We have a component that has no window. Well, no window in managed code - it uses a DLL which itself uses a window, and this is our problem! When the garbage collector runs and removes our component (created dynamically by, say, a button click, and then not referenced any more), the GC runs in a different thread, which prohibits the DLL to destroy its window, resulting in a GPF when the WndProc of that window is called - the code is gone...
10
2550
by: Bryce Calhoun | last post by:
Hello, First of all, this is a .NET 1.1 component I'm creating. SUMMARY ----------------------- This component that I'm creating is, for all intents and purposes, a document parser (I'm actually deserializing a SOAP document into an object and parsing out the fields, but that's fairly immaterial to this
3
1610
by: bilosta | last post by:
Hello to everybody I'm new in win apllications and C#. I have a problem with Threading. Here is my problem: I have a form with button named: BupisiStudente, when I click on it a call next method: private void BUpisiStudente_Click(object sender, EventArgs e) {
11
2416
by: leiz | last post by:
Hi, I am using COM to automate Word. In the main thread of my program, I store all the Document objects from Application.Documents. In one event handler (the event generated by Word), if i get all the current documents using Application.Documents, the objects I got are not same ones stored previously. The event handler is called by some threads generated by C#. But, if I get all the current documents using my own threads, the ones...
5
2533
by: Fei Liu | last post by:
Hello, I have a situation where I need to design a library for multi-thread application, each thread does some work in a client supplied std::ptr_fun(free_function) or a functor. Now since it's a multi-threaded application, naturally I want the call back functor to be created on a per thread basis. Suppose my thread is so defined template <typename servlet_type>
0
9632
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9471
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8958
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.