Click here to Skip to main content
15,881,248 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: Get rid of WaitCursor Pin
BillWoodruff2-Sep-11 19:08
professionalBillWoodruff2-Sep-11 19:08 
GeneralRe: Get rid of WaitCursor Pin
Luc Pattyn3-Sep-11 2:11
sitebuilderLuc Pattyn3-Sep-11 2:11 
GeneralRe: Get rid of WaitCursor Pin
GParkings3-Sep-11 12:20
GParkings3-Sep-11 12:20 
GeneralRe: Get rid of WaitCursor Pin
Eddy Vluggen3-Sep-11 13:15
professionalEddy Vluggen3-Sep-11 13:15 
GeneralRe: Get rid of WaitCursor Pin
Luc Pattyn3-Sep-11 13:36
sitebuilderLuc Pattyn3-Sep-11 13:36 
GeneralRe: Get rid of WaitCursor Pin
Eddy Vluggen3-Sep-11 22:43
professionalEddy Vluggen3-Sep-11 22:43 
GeneralRe: Get rid of WaitCursor Pin
BillWoodruff3-Sep-11 19:19
professionalBillWoodruff3-Sep-11 19:19 
GeneralRe: Get rid of WaitCursor Pin
Luc Pattyn4-Sep-11 2:42
sitebuilderLuc Pattyn4-Sep-11 2:42 
Hi Bill,

1.
memory leak prevention and memory consumption aren't a factor here. All the IDisposable interface and the using pattern achieve is Dispose() is getting called, what you do inside Dispose() is up to you, it doesn't have to relate to memory or resources, see it as "automatic post-processing".

2.
I didn't say it was all happening on a single Form. A database (or any networked) application could easily have say 10 Forms, each Form having five buttons, and a memu bar with 5 main menu's, each holding 5 menu items. That is 250 menu items and 50 buttons all together. And more tables in the database would probably lead to more Forms, more Controls, more WaitCursors.

If I expect any of the click handlers to regularly take more than say 100 msec to execute, I'd use threading, disable the Control and probably show a progress bar and possibly a Cancel button, I would then NOT show a WaitCursor (IMO WaitCursors are for synchronous operations only).

If OTOH I expect those actions to normally take less than 100 msec, then I'd organize them as a synchronous operation, running on the main thread; I would then typically not disable the Control, and show a WaitCursor instead. Of course I'd organize the WaitCursor at the front of the click handler; I would not hide it somewhere in the data access layer (which would reduce the number of WaitCursor statements but also violate the separation-of-concerns concept.

3.
The frequency of LP_WaitCursor instantiations is pretty low, as they appear only in some GUI handlers, i.e. they require the user to click something. That is expected to be less than once per second. If you really care about the number of objects created, abandoned, and finally collected in an app (which I do care about very much), then I suggest you:
- eliminate all new keywords inside handlers that don't take human action as a trigger, say the Paint , Tick, and DataReceived handlers. Ideally there should be NO new Font(...) or new Pen(...) or new Anything(...) inside those, that is where performance is going down the drain.
- carefully investigate everything you do with strings. Most apps, as soon as they are doing something, create hundreds of strings per second, most of them extremely short lived. Using StringBuilder may reduce those numbers, and it may or may not improve performance, however IMO it is strings that justify the existence of automatic garbage collection, and once you have that in place, I don't mind creating a few more objects I could do without, but choose to have, mostly for structuring my code and improving code readability.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: Get rid of WaitCursor Pin
BillWoodruff4-Sep-11 14:21
professionalBillWoodruff4-Sep-11 14:21 
GeneralRe: Get rid of WaitCursor Pin
Luc Pattyn4-Sep-11 14:42
sitebuilderLuc Pattyn4-Sep-11 14:42 
GeneralRe: Get rid of WaitCursor Pin
lukeer4-Sep-11 21:03
lukeer4-Sep-11 21:03 
AnswerRe: Get rid of WaitCursor Pin
Luc Pattyn5-Sep-11 1:29
sitebuilderLuc Pattyn5-Sep-11 1:29 
GeneralRe: Get rid of WaitCursor Pin
MicroVirus5-Sep-11 11:17
MicroVirus5-Sep-11 11:17 
QuestionDeploying Reports Pin
eddieangel30-Aug-11 6:40
eddieangel30-Aug-11 6:40 
AnswerRe: Deploying Reports Pin
army_man7165530-Aug-11 8:00
army_man7165530-Aug-11 8:00 
Questionwindows forms using active directory Pin
dcof24-Aug-11 5:50
dcof24-Aug-11 5:50 
AnswerRe: windows forms using active directory Pin
GenJerDan24-Aug-11 6:16
GenJerDan24-Aug-11 6:16 
GeneralRe: windows forms using active directory Pin
dcof24-Aug-11 11:42
dcof24-Aug-11 11:42 
GeneralRe: windows forms using active directory Pin
GenJerDan25-Aug-11 3:22
GenJerDan25-Aug-11 3:22 
QuestionHost a WPF form/application windows inside a Winform - how? Pin
devvvy16-Aug-11 15:30
devvvy16-Aug-11 15:30 
AnswerRe: Host a WPF form/application windows inside a Winform - how? Pin
Simon Bang Terkildsen20-Aug-11 15:14
Simon Bang Terkildsen20-Aug-11 15:14 
QuestionWindows7 hosts file is ignored Pin
Muammar©13-Aug-11 20:45
Muammar©13-Aug-11 20:45 
AnswerRe: Windows7 hosts file is ignored Pin
Eddy Vluggen13-Aug-11 22:24
professionalEddy Vluggen13-Aug-11 22:24 
AnswerRe: Windows7 hosts file is ignored Pin
DaveAuld13-Aug-11 22:44
professionalDaveAuld13-Aug-11 22:44 
Questionwindows front end Pin
jon18889-Aug-11 14:59
jon18889-Aug-11 14:59 

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.