Click here to Skip to main content
15,916,398 members
Home / Discussions / C#
   

C#

 
GeneralConverting to Integer Pin
Ahmed Galal13-Dec-03 1:26
Ahmed Galal13-Dec-03 1:26 
GeneralRe: Converting to Integer Pin
Heath Stewart13-Dec-03 6:33
protectorHeath Stewart13-Dec-03 6:33 
GeneralRe: Converting to Integer Pin
Ahmed Galal13-Dec-03 9:03
Ahmed Galal13-Dec-03 9:03 
GeneralRe: Converting to Integer Pin
Colin Angus Mackay13-Dec-03 9:33
Colin Angus Mackay13-Dec-03 9:33 
GeneralRe: Converting to Integer Pin
Heath Stewart13-Dec-03 16:19
protectorHeath Stewart13-Dec-03 16:19 
GeneralRe: Converting to Integer Pin
leppie13-Dec-03 8:51
leppie13-Dec-03 8:51 
GeneralRe: Converting to Integer Pin
Meysam Mahfouzi13-Dec-03 16:48
Meysam Mahfouzi13-Dec-03 16:48 
GeneralOLE Pin
Abdulghani Sabbagh12-Dec-03 23:58
Abdulghani Sabbagh12-Dec-03 23:58 
GeneralRe: OLE Pin
Heath Stewart13-Dec-03 6:29
protectorHeath Stewart13-Dec-03 6:29 
GeneralOpen document managment API Pin
Abdulghani Sabbagh12-Dec-03 23:56
Abdulghani Sabbagh12-Dec-03 23:56 
GeneralRe: Open document managment API Pin
Heath Stewart13-Dec-03 6:37
protectorHeath Stewart13-Dec-03 6:37 
GeneralCustom draw Treeview Control Pin
MrJJKoolJ12-Dec-03 16:02
MrJJKoolJ12-Dec-03 16:02 
GeneralRe: Custom draw Treeview Control Pin
eggie512-Dec-03 18:17
eggie512-Dec-03 18:17 
GeneralRe: Custom draw Treeview Control Pin
Alex Korchemniy13-Dec-03 13:49
Alex Korchemniy13-Dec-03 13:49 
GeneralRe: Custom draw Treeview Control Pin
eggie513-Dec-03 14:52
eggie513-Dec-03 14:52 
GeneralC# control hosed in ActiveX: no tabbing Pin
thedex12-Dec-03 11:31
thedex12-Dec-03 11:31 
GeneralRe: C# control hosed in ActiveX: no tabbing Pin
Heath Stewart12-Dec-03 12:01
protectorHeath Stewart12-Dec-03 12:01 
GeneralListView BeginUpdate not working Pin
Darryl Borden12-Dec-03 11:28
Darryl Borden12-Dec-03 11:28 
GeneralRe: ListView BeginUpdate not working Pin
Heath Stewart12-Dec-03 11:40
protectorHeath Stewart12-Dec-03 11:40 
This is happening because, while the control is not visible, the Windows handle is not created. When the Windows handle is not created, no sorting (and a few other things) is done. If the control is visible - even if it isn't currently painting items - it sorts with each addition to the Items collection!

Even using the LockWindowsUpdate API won't do anything to resolve this issue. The BeginUpdate and EndUpdate methods essentially do the same thing. They disable and enable drawing (respectively) by using the WM_SETREDRAW message. While it isn't documented, LockWindowsUpdate probably does this very same thing.

So, you'll either have to bite the bullet and accept the lag, or hide your control and reshow it when you're finished, but that might be annoying to the user. If nothing else, show a progress bar (so add the items in a separate thread, but be sure to use InvokeRequired and Invoke to actually add the items!) while you're adding items to the user knows that something's happening and that they should way. You should also use a try-finally block to show the wait cursor (Cursor.Current = Cursors.WaitCursor) and, in the finally block, set it back to the default (Cursor.Current = Cursors.Default).

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralOutloog slidemenu control in C# Pin
naxos12-Dec-03 10:36
naxos12-Dec-03 10:36 
GeneralRe: Outloog slidemenu control in C# Pin
Heath Stewart12-Dec-03 11:31
protectorHeath Stewart12-Dec-03 11:31 
GeneralRe: Outloog slidemenu control in C# Pin
Luis Alonso Ramos13-Dec-03 21:53
Luis Alonso Ramos13-Dec-03 21:53 
GeneralProblem with ListBox heights Pin
blakeb_112-Dec-03 6:35
blakeb_112-Dec-03 6:35 
GeneralRe: Problem with ListBox heights Pin
leppie12-Dec-03 6:39
leppie12-Dec-03 6:39 
GeneralComboBox Pin
Gary Kirkham12-Dec-03 5:32
Gary Kirkham12-Dec-03 5:32 

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.