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

  • Home
  • SEARCH
  • 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 8343291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:00:53+00:00 2026-06-09T06:00:53+00:00

Here is what i am using, but i get an error: private void listView1_DoubleClick(object

  • 0

Here is what i am using, but i get an error:

private void listView1_DoubleClick(object sender, EventArgs e)
{
    foreach (ListViewItem itm in listView1.SelectedItems)
    {
        pictureBox1.Image = System.Drawing.Image.FromFile(itm.SubItems[1].Text);
    }
}

i get: InvalidArgument=Value of '1' is not valid for 'index'.
Parameter name: index

How do i fix this problem?

this is how i fill the listview with the images in the image list (which are added in the properties items collection)

for (int j = 0; j < this.imageList1.Images.Count; j++)
        {
            ListViewItem item = new ListViewItem();
            item.ImageIndex = j;
            this.listView1.Items.Add(item);
        }
  • 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-09T06:00:54+00:00Added an answer on June 9, 2026 at 6:00 am

    You listViewItems have only 1 subitem which appear to be the empty string (which is not a valid path).

    An ImageList doesn’t keep the path informations of the images. Instead, it created a copy which is embedded in the executable.

    Try this code instead:

    private void listView1_DoubleClick(object sender, EventArgs e)
    {
        foreach (ListViewItem itm in listView1.SelectedItems)
        {
            int imgIndex = itm.ImageIndex;
            if ( imgIndex >= 0 && imgIndex < this.imageList1.images.Count)
            {
                pictureBox1.Image = this.imageList1.images[imgIndex];
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to follow along to this tut: HERE but using a sprite
I follow example from here using section listview http://lalit3686.blogspot.com/2012/05/sectionadapter.html But how can I implement
I'm trying to run NeHe's tutorial here using Python 2.7.3, but It's throwing the
New developer here,Im using the Custom Image Picker by ray wenderlich. But what I
I am using iCarousel as shownh here .But I want to add images dynamically
I'm using sprintf() in PHP but it displays nothing on the page. Here's what
anyone using the jQuery Elastic plugin around here? Pretty handy but I just don't
New but keen jquery user here, please be gentle :) I am using the
I know that this has already been asked here but the answer (using a
I created report using reporting, but i am dizzy for case below here are

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.