Click here to Skip to main content
15,916,019 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionsuggestion on my design and help with dynamic buttons with right click detection Pin
WillRain26-Sep-08 0:29
WillRain26-Sep-08 0:29 
AnswerRe: suggestion on my design and help with dynamic buttons with right click detection Pin
Smithers-Jones26-Sep-08 1:07
Smithers-Jones26-Sep-08 1:07 
GeneralRe: suggestion on my design and help with dynamic buttons with right click detection Pin
WillRain26-Sep-08 9:31
WillRain26-Sep-08 9:31 
GeneralRe: suggestion on my design and help with dynamic buttons with right click detection Pin
WillRain26-Sep-08 12:52
WillRain26-Sep-08 12:52 
QuestionLabel Display Problem Pin
pdnet25-Sep-08 23:34
pdnet25-Sep-08 23:34 
AnswerRe: Label Display Problem Pin
Johan Hakkesteegt26-Sep-08 0:30
Johan Hakkesteegt26-Sep-08 0:30 
AnswerRe: Label Display Problem Pin
Ashfield26-Sep-08 1:25
Ashfield26-Sep-08 1:25 
AnswerRe: Label Display Problem Pin
Dave Kreskowiak26-Sep-08 2:07
mveDave Kreskowiak26-Sep-08 2:07 
The problem is that this code is running on the UI thread. So, any time your actually executing code, your app is not processing messages from Windows, like WM_PAINT. This tells your window or control to repaint itself, including updating the text you see in a label.

You have two options. The first is very easy. put a Application.DoEvents line right after you set the .Text property of the label. But! There's a problem with this. This command tells the app to process all pending messages in the applications message pump, including other button clicks, or anything else you can click on in your application. This could have disasterous results if you're not prepared for it.

The second option is to move the code that does the deleting to a background thread. You may want to check into the BackgroundWorker component to simplify this about as much as you're going to be able to.


A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: Label Display Problem Pin
Jon_Boy26-Sep-08 3:23
Jon_Boy26-Sep-08 3:23 
AnswerRe: Label Display Problem Pin
LloydA11126-Sep-08 23:20
LloydA11126-Sep-08 23:20 
QuestionBinding control to custom class [modified] Pin
webspeed25-Sep-08 21:07
webspeed25-Sep-08 21:07 
QuestionConsole application 6 Pin
joselito j. mebolos25-Sep-08 16:25
joselito j. mebolos25-Sep-08 16:25 
AnswerRe: Console application 6 Pin
MikeMarq25-Sep-08 16:51
MikeMarq25-Sep-08 16:51 
AnswerRe: Console application 6 Pin
Smithers-Jones25-Sep-08 20:58
Smithers-Jones25-Sep-08 20:58 
AnswerRe: Console application 6 Pin
Ashfield25-Sep-08 21:39
Ashfield25-Sep-08 21:39 
GeneralRe: Console application 6 Pin
Johan Hakkesteegt25-Sep-08 22:56
Johan Hakkesteegt25-Sep-08 22:56 
GeneralRe: Console application 6 Pin
Ashfield26-Sep-08 1:26
Ashfield26-Sep-08 1:26 
AnswerRe: Console application 6 Pin
Jon_Boy26-Sep-08 2:31
Jon_Boy26-Sep-08 2:31 
AnswerForum posting guidelines Pin
David Mujica26-Sep-08 3:11
David Mujica26-Sep-08 3:11 
AnswerWhat number follows six? Pin
Guffa26-Sep-08 6:16
Guffa26-Sep-08 6:16 
AnswerRe: Console application 6 Pin
LloydA11126-Sep-08 23:22
LloydA11126-Sep-08 23:22 
Questionconsole application 6 Pin
joselito j. mebolos25-Sep-08 16:23
joselito j. mebolos25-Sep-08 16:23 
AnswerPretty lazy. Pin
Dave Kreskowiak25-Sep-08 19:29
mveDave Kreskowiak25-Sep-08 19:29 
AnswerRe: console application 6 Pin
Jon_Boy26-Sep-08 2:30
Jon_Boy26-Sep-08 2:30 
Questionconsole application 5 Pin
joselito j. mebolos25-Sep-08 16:22
joselito j. mebolos25-Sep-08 16:22 

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.