possible listbox BeginUpdate() / EndUpdate() bug?

  • Thread starter =?iso-8859-1?B?wWf6c3Q=?=
  • Start date
?

=?iso-8859-1?B?wWf6c3Q=?=

Hi

I have the following code which lodes names of
wordtemplates into my .NET windowsforms app:
--
//lsbTemplate.BeginUpdate();
lsbTemplate.Items.Clear();
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(
p_sPathToTemplates );
System.IO.FileInfo[] arFi = di.GetFiles( "*(*" +
p_sHelpDesk + "*).dot" );

if( arFi.Length == 0 )
{
lsbTemplate.Sorted = false;
//lsbTemplate.EndUpdate();
return;
}
else
{
lsbTemplate.Sorted = true;
}

foreach( System.IO.FileInfo fi in arFi )
{
if( fi.Name.IndexOf( "~" ) < 0 )
{//DO not show templates which include ~ ...
lsbTemplate.Items.Add( fi.Name );
}
}
//lsbTemplate.EndUpdate();
---
Notice the calls to BeginUpdate and EndUpdate at the
beginning and the end. When theese lines of code are
active ( not commented out ) the listbox doesn't show any
items if there's only one items loaded. Actually, by
clicking the listbox you can click the top item, but there
is no text shown. If there are 2 or more items all items
show up ok.
After commenting out BeginUpdate and EndUpdate the listbox
show's this one item ok.

I haven't been able to think of any reason for this. I
would like to use BeginUpdate and EndUpdate because it
boost's GUI performance when updating the listbox, but
until this is resolved I will skip them.

Any hint's welcomed, best regards, Ágúst from Iceland
 
?

=?iso-8859-1?B?wWf6c3Q=?=

By the way, I'm using most recent version of .NET
framework and VS.NET 2003
 
Top