AlexS
10/27/2003 10:52:00 PM
Don't know if this is known or not - I can't find anything describing my
issue.
I fill standard listbox in form Load event handler using loop with
lb.Items.Add(someString) inside BeginUpdate/EndUpdate - exactly as MS
prescribes in MSDN samples. Except that immediately after BeginUpdate I
issue listbox.Items.Clear(); Then follows the adding loop.
Problem is that sometimes listbox is displayed as empty one - no entries -
after addition of 1 or more entries in this loop. Problem happens
irregularly. Usually in 1 case from around 100.
I start to wonder if this is related to Load event and possibly sequencing
of internal messages in 1.1. Anybody has any clue what could be the reason?
I tried to use listbox.Invalidate() and listbox.Update() after final
EndUpdate - however found out that this doesn't exclude my problem
completely. Today once again I got empty listbox on screen after adding 1
entry. When I intercept loop in debugger usually everything is displayed Ok.
The only thing which I was able to remark so far is that usually this
problem happens when number of added entries is less than number of entries,
which fit in listbox page. E.g. if listbox is able to show 20 entries I can
expect this problem when I add less than 20 entries in form.Load event
handler. Similar with Listview control.
Thanks!
Alex