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 8262117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:39:26+00:00 2026-06-08T03:39:26+00:00

Okay, how do I programmatically add items from an List<ListViewItem.ListViewSubItem> to an ListView ?

  • 0

Okay, how do I programmatically add items from an List<ListViewItem.ListViewSubItem> to an ListView? I am trying to load 3 lists of items next to each other, but it doesn’t seem to work…

Here’s some code I have right now:

    //----------PluginHandler.cs----------/

public static List<ListViewItem> PluginList = new List<ListViewItem>();
public static List<ListViewItem.ListViewSubItem> PluginList2 = new List<ListViewItem.ListViewSubItem>();

PluginList.Clear();
PluginList2.Clear();
foreach (var item in plugin.versions)
{
    var lvitem = new ListViewItem { Text = item.name };
    var lvitem2 = new ListViewItem.ListViewSubItem { Text = item.filename };
    PluginList.Add(lvitem);
    PluginList2.Add(lvitem2);
}

    //----------Form1.cs----------/

lvPluginInfo.Items.AddRange(PluginHandler.PluginList.ToArray());
lvPluginInfo.Items[0].SubItems.AddRange(PluginHandler.PluginList2.ToArray());

The output I get isn’t really what I want, it keeps adding subitems to the right instead of adding them next to eachother like:

item1a | item2a
item1b | item2b
…

Now I get:
item1a | item2a | item1b | item2b | …

Any ideas? Thanks!

  • 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-08T03:39:27+00:00Added an answer on June 8, 2026 at 3:39 am

    You seem to be going about this in a very odd fashion. I assume this is what you’re intending to do?

    lvPluginInfo.Items.Clear();
    foreach (var item in plugin.versions)
    {
        var lvitem = new ListViewItem(item.name);
        lvitem.SubItems.Add(item.filename);
        lvPluginInfo.Items.Add(lvitem);
    }
    

    The problem with the way you’re going about it is the following line: lvPluginInfo.Items[0].SubItems.AddRange(PluginHandler.PluginList2.ToArray());. You’re adding all the subitems to the first ListViewItem. Adding the items outside of the loop doesn’t make much sense here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so I have a list of addresses and next them there is a
Okay, next PHPExcel question. I have an HTML form that users fill out and
I'm trying to scrape a website where the URL is redirected, however programmatically trying
Okay, I'm trying to reverse engineer a feature on a website I found -
Okay so here is what I'm trying to accomplish. First of all below table
Is there a way to programmatically interface with iTunes to add new playlists or
Possible Duplicate: How Turn on only Camera flash light programmatically in android? okay guys,
I'm simply trying to delete a row from a DataGridView. Basically, the first column
I have an activity with five tabs. Everything looks okay when I go from
Okay this question is very simple: I have a facebook page, and a website.

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.