المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : ListView being buggy



C# Programming
11-11-2009, 10:50 AM
I have a ListView control with a column(just for temp. test) and 2 Groups.

Now, the LV getting populated with 10 items(0..9) and associated with first group in ListView. Now when all done, I'm iterating the Items collection. And found it same as appearing in ListView.

http://img40.imageshack.us/i/40225142.png/[^ (http://img40.imageshack.us/i/40225142.png/)]

private void Form1_Load(object sender, EventArgs e)
{
for (int a = 0; a < 10; a++)
{
ListViewItem lvi = new ListViewItem(a.ToString());
listView1.Items.Add(lvi);
listView1.Groups[0].Items.Add(lvi);
}
}

private void button1_Click(object sender, EventArgs e)
{
richTextBox1.Clear();
for (int a = 0; a < listView1.Items.Count; a++)
{
richTextBox1.Text += listView1.Items[a].Text + "\r\n";
}
}




now, When I set its sort to Descending...it appears like this

http://img39.imageshack.us/i/43854370.png/[^ (http://img39.imageshack.us/i/43854370.png/)]

In the above screenshot, the indexes are accurate but its showing '9' at the end.

So I thought to add/insert items manually without using inbuilt sorting. And I did but problem persists. Its showing in the sequence the items added/inserted. However the indexes are correct. Any idea guys ?

I also tried ListView.RedrawItems() but nothing seems to works.



TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87?‘6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8?mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y


-----------------------------------------------
128 bit encrypted signature, crack if you can