Click here to Skip to main content
15,908,675 members
Home / Discussions / C#
   

C#

 
QuestionEnterprise Library Logger without editing app.config Pin
Stas17-Aug-07 5:01
Stas17-Aug-07 5:01 
AnswerRe: Enterprise Library Logger without editing app.config Pin
Mark Churchill17-Aug-07 5:19
Mark Churchill17-Aug-07 5:19 
GeneralRe: Enterprise Library Logger without editing app.config Pin
Stas17-Aug-07 5:39
Stas17-Aug-07 5:39 
QuestionHow can I include xml files? Pin
miljanms17-Aug-07 4:42
miljanms17-Aug-07 4:42 
AnswerRe: How can I include xml files? Pin
Mark Churchill17-Aug-07 5:22
Mark Churchill17-Aug-07 5:22 
AnswerRe: How can I include xml files? Pin
miljanms20-Aug-07 1:05
miljanms20-Aug-07 1:05 
QuestionTrouble changing Label text Pin
Evan St. John17-Aug-07 4:00
Evan St. John17-Aug-07 4:00 
AnswerRe: Trouble changing Label text Pin
Luc Pattyn17-Aug-07 4:37
sitebuilderLuc Pattyn17-Aug-07 4:37 
Hi,

everything a Windows app does is event driven, which means there is an input queue,
a lot of messages, and a "message pump" which fetches messages form that queue
and acts on them. Your button click turns into a message, and the message pump
calls your click handler; as long as you are executing inside your click handler
your message pump is waiting for you to finish, before it can process the next
message; that's why the label update seems late.

There are three ways to escape from this:
- showing another modal form (such as MessageBox) launches a new message pump;
of course that is not the right solution, it just explains how it seems to help.
- adding Application.DoEvents() causes the immediate handling of all messages
currently in the queue; this may or may not solve it, it typically does for
simple situations.
- using another thread: this is the general solution for situations where you
want the GUI to be alive while your app is still working on something; it comes
at a cost: you need to set up communications between the main thread and the
new thread, and, the new thread is not allowed to touch your Controls directly;
it needs to use Control.InvokeRequired and Control.Invoke; if you decide to
go this route, make sure to read up on it, and have a look at some examples.

So I suggest you try adding one or two DoEvents() inside your click handler.
And then read up on the different keywords I handed to you.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]


this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google


GeneralRe: Trouble changing Label text Pin
Evan St. John17-Aug-07 5:13
Evan St. John17-Aug-07 5:13 
AnswerRe: Trouble changing Label text [modified] Pin
Khoramdin17-Aug-07 8:18
Khoramdin17-Aug-07 8:18 
QuestionMouse click pos detection, and it's indication Pin
MeLight17-Aug-07 3:16
MeLight17-Aug-07 3:16 
AnswerRe: Mouse click pos detection, and it's indication Pin
Luc Pattyn17-Aug-07 3:58
sitebuilderLuc Pattyn17-Aug-07 3:58 
AnswerRe: Mouse click pos detection, and it's indication Pin
Justin Perez17-Aug-07 3:59
Justin Perez17-Aug-07 3:59 
Questionmicrosoft report and export as word Pin
erdemciga17-Aug-07 3:00
erdemciga17-Aug-07 3:00 
AnswerRe: microsoft report and export as word Pin
Justin Perez17-Aug-07 3:01
Justin Perez17-Aug-07 3:01 
Question3 Tier Architecture Pin
Tsepoz17-Aug-07 2:47
Tsepoz17-Aug-07 2:47 
AnswerRe: 3 Tier Architecture Pin
J4amieC17-Aug-07 2:56
J4amieC17-Aug-07 2:56 
GeneralRe: 3 Tier Architecture Pin
Wes Aday17-Aug-07 4:37
professionalWes Aday17-Aug-07 4:37 
Questionunable to load the dll Pin
dukuria17-Aug-07 2:32
dukuria17-Aug-07 2:32 
AnswerRe: unable to load the dll Pin
Johan Lombaard17-Aug-07 2:47
Johan Lombaard17-Aug-07 2:47 
QuestionRe:Displaying Messagebox within client Region Pin
RameshwerE17-Aug-07 2:27
RameshwerE17-Aug-07 2:27 
AnswerRe:Displaying Messagebox within client Region Pin
Hessam Jalali17-Aug-07 5:45
Hessam Jalali17-Aug-07 5:45 
QuestionHow to get a CSV file into a table? Pin
dorine8217-Aug-07 1:58
dorine8217-Aug-07 1:58 
AnswerRe: How to get a CSV file into a table? Pin
error140817-Aug-07 2:13
error140817-Aug-07 2:13 
AnswerRe: How to get a CSV file into a table? Pin
Justin Perez17-Aug-07 2:19
Justin Perez17-Aug-07 2:19 

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.