Click here to Skip to main content
15,908,111 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: esc key Pin
Herboren7-Apr-11 4:58
Herboren7-Apr-11 4:58 
AnswerRe: esc key Pin
Luc Pattyn7-Apr-11 5:01
sitebuilderLuc Pattyn7-Apr-11 5:01 
GeneralRe: esc key Pin
Herboren7-Apr-11 5:11
Herboren7-Apr-11 5:11 
GeneralRe: esc key Pin
Luc Pattyn7-Apr-11 5:20
sitebuilderLuc Pattyn7-Apr-11 5:20 
QuestionAccessing Printer Settings Not Built Into .NET Pin
Dominick Marciano31-Mar-11 5:42
professionalDominick Marciano31-Mar-11 5:42 
AnswerRe: Accessing Printer Settings Not Built Into .NET Pin
Johan Hakkesteegt13-Apr-11 23:01
Johan Hakkesteegt13-Apr-11 23:01 
QuestionWebrequest & GUI Refresh (Threading?) Pin
cipherwar28-Mar-11 22:37
cipherwar28-Mar-11 22:37 
AnswerRe: Webrequest & GUI Refresh (Threading!) Pin
Luc Pattyn28-Mar-11 23:53
sitebuilderLuc Pattyn28-Mar-11 23:53 
Hi,

your code doesn't need optimizing; it is wrong, and it needs a make-over.

As it is, everything runs on the main thread, a big loop gets started by pressing a button, and inside the loop all web pages get loaded using a blocking call (Stream.ReadToEnd). As a result the GUI is dead for as long as that takes. For proper GUI response, you should not have any blocking calls in an event handler!

The easiest solution would be to add one thread that handles the web stuff; in this case a BackgroundWorker would be an excellent choice: whatever you put in the DoWork handler will run on a background thread and not freeze the GUI; so put the fetch loop there. However, you are not allowed to touch GUI accesses from a different thread, and that is where ReportProgress comes in: call that method to pass results onto the ProgressChanged handler which automagically executes on the main thread (assuming it was the main thread that created the BGW to begin with).

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: Webrequest & GUI Refresh (Threading!) Pin
cipherwar29-Mar-11 1:58
cipherwar29-Mar-11 1:58 
GeneralRe: Webrequest & GUI Refresh (Threading!) Pin
Luc Pattyn29-Mar-11 2:08
sitebuilderLuc Pattyn29-Mar-11 2:08 
GeneralRe: Webrequest & GUI Refresh (Threading!) Pin
cipherwar30-Mar-11 19:18
cipherwar30-Mar-11 19:18 
GeneralRe: Webrequest & GUI Refresh (Threading!) Pin
Luc Pattyn30-Mar-11 22:08
sitebuilderLuc Pattyn30-Mar-11 22:08 
QuestionHow to Get Login and Log off information in Windows [modified] Pin
εїзεїзεїз27-Mar-11 22:23
εїзεїзεїз27-Mar-11 22:23 
AnswerRe: How to Get Login and Log off information in Windows Pin
Eddy Vluggen27-Mar-11 22:36
professionalEddy Vluggen27-Mar-11 22:36 
GeneralRe: How to Get Login and Log off information in Windows Pin
εїзεїзεїз27-Mar-11 22:44
εїзεїзεїз27-Mar-11 22:44 
GeneralRe: How to Get Login and Log off information in Windows Pin
Richard MacCutchan27-Mar-11 23:14
mveRichard MacCutchan27-Mar-11 23:14 
GeneralRe: How to Get Login and Log off information in Windows Pin
εїзεїзεїз27-Mar-11 23:32
εїзεїзεїз27-Mar-11 23:32 
GeneralRe: How to Get Login and Log off information in Windows Pin
Eddy Vluggen28-Mar-11 0:47
professionalEddy Vluggen28-Mar-11 0:47 
GeneralRe: How to Get Login and Log off information in Windows Pin
εїзεїзεїз28-Mar-11 3:37
εїзεїзεїз28-Mar-11 3:37 
QuestionRe: How to Get Login and Log off information in Windows Pin
Eddy Vluggen28-Mar-11 4:05
professionalEddy Vluggen28-Mar-11 4:05 
GeneralRe: How to Get Login and Log off information in Windows Pin
imen53228-Mar-11 20:55
imen53228-Mar-11 20:55 
GeneralRe: How to Get Login and Log off information in Windows Pin
Eddy Vluggen29-Mar-11 0:34
professionalEddy Vluggen29-Mar-11 0:34 
AnswerRe: How to Get Login and Log off information in Windows Pin
Luc Pattyn28-Mar-11 3:16
sitebuilderLuc Pattyn28-Mar-11 3:16 
GeneralRe: How to Get Login and Log off information in Windows Pin
εїзεїзεїз28-Mar-11 3:29
εїзεїзεїз28-Mar-11 3:29 
AnswerRe: How to Get Login and Log off information in Windows Pin
Luc Pattyn28-Mar-11 3:36
sitebuilderLuc Pattyn28-Mar-11 3:36 

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.