InvalidArgument=Value of '0' is not valid for 'index'+listview 2005

Posted on 2011-10-24
Last Modified: 2012-05-12
This piece of code gives the error :
InvalidArgument=Value of '0' is not valid for 'index'.
Parameter name: index

   If Results.Item(IntResultsCount).SubItems.Count > 4 Then'this line errors
                        .Item(IntResultsCount).SubItems(3).Text = Err.Number
                        .Item(IntResultsCount).SubItems.Insert(3, New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, Err.Number))
                    End If

Any help appreciated.
Question by:RIAS
    LVL 33

    Expert Comment

    How many Items does Results have at that point?

    Author Comment

    How do I check that?
    LVL 33

    Accepted Solution

    Run it in debug mode, stepping through the code at that point.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now