Click to See Complete Forum and Search --> : ArgumentOutOfRange


poymode
December 26th, 2009, 12:53 AM
Hello.

I have this ListView which has 5 columns. I am trying to access the 6th item of my ListView using

listview.Items[0].Subitems[5].Text

but it gives me an InvalidArgument=Value of '5' is not valid for 'index'. error.

I have declared in instantiated all columns, I can even access the 1st,3rd to 5th column but not the 6th.

Anyone?

Arjay
December 26th, 2009, 12:57 AM
SubItems[5] is trying to access the 6th column. How many columns do you have?

poymode
December 26th, 2009, 01:01 AM
Yes, I am trying to access my 6th column. I have 6 columns all in all.

kristof1104
December 26th, 2009, 02:24 AM
Make sure your item had 5 subitems!

poymode
December 26th, 2009, 02:44 AM
Make sure your item had 5 subitems!

woah.didnt see that coming...thanks =)