Click here to Skip to main content
15,921,660 members
Home / Discussions / C#
   

C#

 
GeneralRe: Contains method doesn't work on BindingList Pin
Wendelius30-Nov-08 12:02
mentorWendelius30-Nov-08 12:02 
GeneralRe: Contains method doesn't work on BindingList Pin
mahraja30-Nov-08 12:10
mahraja30-Nov-08 12:10 
GeneralRe: Contains method doesn't work on BindingList Pin
Wendelius30-Nov-08 12:16
mentorWendelius30-Nov-08 12:16 
Question.net Remoting - Initializing server objects. [modified] Pin
Member 232448330-Nov-08 6:52
Member 232448330-Nov-08 6:52 
AnswerRe: .net Remoting - Initializing server objects. Pin
Member 232448330-Nov-08 12:54
Member 232448330-Nov-08 12:54 
Questiongroupbox behavior Pin
electriac30-Nov-08 6:36
electriac30-Nov-08 6:36 
AnswerRe: groupbox behavior Pin
Wendelius30-Nov-08 11:33
mentorWendelius30-Nov-08 11:33 
GeneralRe: groupbox behavior Pin
Luc Pattyn30-Nov-08 11:48
sitebuilderLuc Pattyn30-Nov-08 11:48 
Hi George,

the way I understand your code, the following is going on:

1. as long as files are being copied your GUI is dead, since the GUI thread can't do useful things as long as it is busy executing button1_Click handler; that is a no no,
an event handler should not take longer than the time a user is willing to wait, it should always remain responsive to window moves, window getting uncovered, etc, so each handler should run in less than say 30 msec, something yours is not guaranteed to do.

2. as a result, the label2 text updates do not show

3. however the label3 text update behaves as you would like it to occur: after all the file copying has been done.

The solution to all the above is:

1. use a Thread or easier yet a BackgroundWorker to do most of what your Click routine does, so the Click routine just fires the BGW and returns immediately.

2. don't forget to apply whatever it takes to avoid cross-thread control operations (i.e. either Control.InvokeRequired/Control.Invoke when using a Thread, or using BGW.Progress when using a BGW).


Furthermore you may want to add some try-catch logic around the File.Copy stuff since it may fail for one of several reasons (destination exists, disk full, whatever).

Greetings,

Luc Pattyn [Forum Guidelines] [My Articles]

Fixturized forever. Confused | :confused:


GeneralRe: groupbox behavior Pin
electriac30-Nov-08 12:09
electriac30-Nov-08 12:09 
GeneralRe: groupbox behavior Pin
Luc Pattyn30-Nov-08 12:27
sitebuilderLuc Pattyn30-Nov-08 12:27 
GeneralRe: groupbox behavior Pin
electriac30-Nov-08 15:16
electriac30-Nov-08 15:16 
GeneralRe: groupbox behavior Pin
Luc Pattyn30-Nov-08 15:43
sitebuilderLuc Pattyn30-Nov-08 15:43 
Questiondeserialize issue Pin
George_George30-Nov-08 3:45
George_George30-Nov-08 3:45 
AnswerRe: deserialize issue [modified] Pin
User 665830-Nov-08 3:58
User 665830-Nov-08 3:58 
AnswerRe: deserialize issue Pin
Giorgi Dalakishvili30-Nov-08 4:20
mentorGiorgi Dalakishvili30-Nov-08 4:20 
QuestionImplementing Audit Trail for Objects in C#? Pin
abmv30-Nov-08 3:25
professionalabmv30-Nov-08 3:25 
AnswerRe: Implementing Audit Trail for Objects in C#? Pin
User 665830-Nov-08 4:03
User 665830-Nov-08 4:03 
GeneralRe: Implementing Audit Trail for Objects in C#? Pin
abmv30-Nov-08 6:35
professionalabmv30-Nov-08 6:35 
AnswerRe: Implementing Audit Trail for Objects in C#? Pin
Pete O'Hanlon30-Nov-08 9:40
mvePete O'Hanlon30-Nov-08 9:40 
QuestionCreating an Alias to SQL Server and configure remote access control via code ? Pin
calanit30-Nov-08 1:13
calanit30-Nov-08 1:13 
AnswerRe: Creating an Alias to SQL Server and configure remote access control via code ? Pin
Wendelius30-Nov-08 4:03
mentorWendelius30-Nov-08 4:03 
GeneralRe: Creating an Alias to SQL Server and configure remote access control via code ? Pin
calanit30-Nov-08 5:44
calanit30-Nov-08 5:44 
GeneralRe: Creating an Alias to SQL Server and configure remote access control via code ? Pin
Wendelius30-Nov-08 6:21
mentorWendelius30-Nov-08 6:21 
GeneralRe: Creating an Alias to SQL Server and configure remote access control via code ? Pin
calanit30-Nov-08 22:44
calanit30-Nov-08 22:44 
GeneralRe: Creating an Alias to SQL Server and configure remote access control via code ? Pin
Wendelius1-Dec-08 4:39
mentorWendelius1-Dec-08 4:39 

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.