Sorted C# ListBox with one item

  • Thread starter Thread starter Wade Matveyenko
  • Start date Start date
W

Wade Matveyenko

I am using the 1.1 framework. I have a ListBox with the
sorted property set to true. I try to add one item to
the list and the item does not display. If I add two
items, the first item and the second item displays. The
code I use to add the items to the list box look like
this:

private void button1_Click(object sender,
System.EventArgs e)
{
this.listBox1.BeginUpdate();
this.listBox1.Items.Add("blah blah blah");
this.listBox1.EndUpdate();
}

Thanks,
Wade Matveyenko
 
Hi Wade,
It seems like a bug in Listbox, I'll contact our test group to verify
it.
But I find the a simple work around by just calling the EndUpdate method
twice.
I hope this is helpful to your problem, if you stilll have problem on it
,please let me know, Thanks!



Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" shouldbe removed before
sending, Thanks!

--------------------
| Content-Class: urn:content-classes:message
| From: "Wade Matveyenko" <[email protected]>
| Sender: "Wade Matveyenko" <[email protected]>
| Subject: Sorted C# ListBox with one item
| Date: Mon, 22 Sep 2003 16:59:00 -0700
| Lines: 17
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOBZX5C7o2ZwK15QlaTUxK28b11hA==
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:52908
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| I am using the 1.1 framework. I have a ListBox with the
| sorted property set to true. I try to add one item to
| the list and the item does not display. If I add two
| items, the first item and the second item displays. The
| code I use to add the items to the list box look like
| this:
|
| private void button1_Click(object sender,
| System.EventArgs e)
| {
| this.listBox1.BeginUpdate();
| this.listBox1.Items.Add("blah blah blah");
| this.listBox1.EndUpdate();
| }
|
| Thanks,
| Wade Matveyenko
|
 
Back
Top