Click here to Skip to main content
15,901,426 members
Home / Discussions / C#
   

C#

 
GeneralDIVIDE APPLICATION TO FRAMES Pin
binary_c220-Nov-04 16:52
binary_c220-Nov-04 16:52 
GeneralRe: DIVIDE APPLICATION TO FRAMES Pin
Luis Alonso Ramos20-Nov-04 21:30
Luis Alonso Ramos20-Nov-04 21:30 
GeneralCustom Control Property Pin
pjholliday20-Nov-04 10:51
pjholliday20-Nov-04 10:51 
GeneralRe: Custom Control Property Pin
sreejith ss nair20-Nov-04 18:47
sreejith ss nair20-Nov-04 18:47 
Generalupdating a form while in a loop Pin
Anonymous20-Nov-04 6:56
Anonymous20-Nov-04 6:56 
GeneralRe: updating a form while in a loop Pin
Pauwll20-Nov-04 7:21
Pauwll20-Nov-04 7:21 
GeneralRe: updating a form while in a loop Pin
Anonymous21-Nov-04 4:04
Anonymous21-Nov-04 4:04 
GeneralRe: updating a form while in a loop Pin
Sebastian Schneider21-Nov-04 23:29
Sebastian Schneider21-Nov-04 23:29 
This is because your Userinterface and Download are in the same thread, as mentioned before. A thread is linear, meaning in order to execute order 3, you need to do 1 and 2 first.

This means, if you have a thread which loops from 1 to 10 and prints, the result will be:
1
2
3
4
5
6
7
8
9
10

Your program is busy with the Download code, so it cannot execute the UI-code at the same time.

What you need to read about is "multithreading", e.g. have your computer do several things at the same time.

If you had 2 threads looping from 1 to 10, you could get:

1
1
2
3
2
4
3
5
4
5
6
6
7
7
8
9
8
10
9
10

This is because Windows decides which thread gets to execute at any time, but tries to divide processing time evenly among threads (this changes if you start messing with priorities).

Fire up MSDN (online or local) and read up on the System.Threading namespace.

If you have a static method you want to run in its own thread, just
create a new thread (Thread oThread = new Thread(new ThreadStart(myStaticMethod));) and then start this thread (oThread.Start();).

It will automatically stop after it has completed its work.

You could also use QueueUserWorkItem if you want Windows to take care of creating and starting your thread, or you could use asynchronous methods for your FTPing.

Cheers
Sebs
GeneralRe: updating a form while in a loop Pin
Anonymous22-Nov-04 16:37
Anonymous22-Nov-04 16:37 
QuestionImport and save Excel file ??? Pin
npqk20-Nov-04 6:53
npqk20-Nov-04 6:53 
AnswerRe: Import and save Excel file ??? Pin
sreejith ss nair20-Nov-04 19:30
sreejith ss nair20-Nov-04 19:30 
QuestionHow to hide a object's inherited properties ? Pin
Tee+20-Nov-04 6:18
Tee+20-Nov-04 6:18 
AnswerRe: How to hide a object's inherited properties ? Pin
Daniel Turini20-Nov-04 6:29
Daniel Turini20-Nov-04 6:29 
GeneralRe: How to hide a object's inherited properties ? Pin
Tee+20-Nov-04 6:34
Tee+20-Nov-04 6:34 
GeneralRe: How to hide a object's inherited properties ? Pin
Daniel Turini20-Nov-04 6:37
Daniel Turini20-Nov-04 6:37 
GeneralRe: How to hide a object's inherited properties ? Pin
Tee+20-Nov-04 7:03
Tee+20-Nov-04 7:03 
GeneralRe: How to hide a object's inherited properties ? Pin
Daniel Turini20-Nov-04 7:07
Daniel Turini20-Nov-04 7:07 
GeneralRe: How to hide a object's inherited properties ? Pin
Tee+20-Nov-04 17:29
Tee+20-Nov-04 17:29 
AnswerRe: How to hide a object's inherited properties ? Pin
sreejith ss nair20-Nov-04 19:02
sreejith ss nair20-Nov-04 19:02 
GeneralRe: How to hide a object's inherited properties ? Pin
Tee+20-Nov-04 22:44
Tee+20-Nov-04 22:44 
GeneralRe: How to hide a object's inherited properties ? Pin
sreejith ss nair21-Nov-04 16:56
sreejith ss nair21-Nov-04 16:56 
GeneralOpen folder Pin
Anonymous20-Nov-04 6:00
Anonymous20-Nov-04 6:00 
GeneralRe: Open folder Pin
Daniel Turini20-Nov-04 6:32
Daniel Turini20-Nov-04 6:32 
GeneralRe: Open folder Pin
sreejith ss nair20-Nov-04 19:41
sreejith ss nair20-Nov-04 19:41 
GeneralDatabase independent access: Mimer Vs DAC Pin
devvvy20-Nov-04 5:41
devvvy20-Nov-04 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.