CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2009
    Posts
    7

    ArgumentOutOfRange

    Hello.

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

    Code:
    listview.Items[0].Subitems[5].Text
    but it gives me an
    Code:
     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?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: ArgumentOutOfRange

    SubItems[5] is trying to access the 6th column. How many columns do you have?

  3. #3
    Join Date
    Aug 2009
    Posts
    7

    Re: ArgumentOutOfRange

    Yes, I am trying to access my 6th column. I have 6 columns all in all.

  4. #4
    Join Date
    Sep 2006
    Posts
    31

    Re: ArgumentOutOfRange

    Make sure your item had 5 subitems!

  5. #5
    Join Date
    Aug 2009
    Posts
    7

    Re: ArgumentOutOfRange

    Quote Originally Posted by kristof1104 View Post
    Make sure your item had 5 subitems!
    woah.didnt see that coming...thanks =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured