Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8866007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:40:15+00:00 2026-06-14T16:40:15+00:00

I have a quick question about listView’s and how check if a ListView (which

  • 0

I have a quick question about listView’s and how check if a ListView (which contains null items) has a certain string?

Here is the code which add to sepcific items (under column 5 in the listView). It basically checks if that item appears in Google search or not. If it does, it’ll write yes to that specific row, if not it’ll leave it blank:

string google2 = http.get("https://www.google.com/search?q=" + textBox1.Text + "");
                string[] embedid = getBetweenAll(vid, "type='text/html' href='http://www.youtube.com/watch?v=", "&feature=youtube_gdata'/>");

                for (int i = 0; i < embedid.Length; i++)
                {

                    if (google2.Contains(embedid[i]))
                    {
                        listView1.Items[i].SubItems.Add("Yes");
                        }
                    }

Now what I am trying to do is check if that certain column contains items that say Yes. If it does color them Green if not don’t.

Here’s the code for that:

 if (i.SubItems[5].Text.Contains("Yes"))
                        {
                            labelContainsVideo.ForeColor = System.Drawing.Color.Green;
                        }

My issue is I keep getting an error that says InvalidArgument=Value of '5' is not valid for 'index'.

My hunch is that there are null items in column 5 which might be messing it up but I dont know.

Any idea on how to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:40:17+00:00Added an answer on June 14, 2026 at 4:40 pm

    Check the Item to see if the SubItem Collection has the correct Number of values.

    i.e.

    int threshold = 5;
    
    foreach (ListViewItem item in listView1.Items)
    {
        if (item.SubItems.Count > threshold)
        {
            if (item.SubItems[5].Text.Contains("Yes"))
            {
                // Do your work here
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have quick question about jQuery plugins, hope somebody out there has some advice.
I just have a quick question about iterators. I currently want to remove items
I have a quick question about this PHP function here. What is the am
I have a quick question about getting the value from control which I added
I have quick question about text parsing, for example: INPUT=a b c d e
I have a quick question about something I imagine must be pretty easy -
I have a quick question about ARC in iOS. (Sorry I've asked so many
I have a quick question about encapsulating specific types with typedef . Say I
I have a quick question about the dealloc() and viewDidUnload() methods. I notice a
I have a quick question about the accelerometer in Android devices. Is it always

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.