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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:45:40+00:00 2026-05-17T22:45:40+00:00

I got a stupid question on ListView Control usage. I created a Windows Form

  • 0

I got a stupid question on ListView Control usage.
I created a Windows Form App in VS2005. No I dragged a ListView Control from the toolbox. I want to implement my code to show some content(including both columns and rows).
I know a little of MFC knowledge. I am not sure I must study the past MFC CListCtrol knowledge to implement my application or I can just study the System.Windows.Forms::ListView simply.

I found a good sample working with ListView (but wrote in C#). Can I translate the sample code from C# to C++ in VS2005? If I can. Could you please give me some suggestions?

using System;
using System.Windows.Forms;
using System.Drawing;

public class ListView1 : Form {
  ListView listView = new ListView();

  public ListView1() {
    listView.Dock = DockStyle.Fill;
    PopulateListView();
    this.Controls.Add(listView);
    this.ClientSize = new Size(400, 200);
  }


  private void PopulateListView() {
    // Set the view to show details.
    listView.View = View.Details;

    // Add columns
    listView.Columns.Add("Author", 
                         -2, 
                         HorizontalAlignment.Center);
    listView.Columns.Add("Title", 
                         -2, 
                         HorizontalAlignment.Left);
    listView.Columns.Add("Price", 
                         -2, 
                         HorizontalAlignment.Left);

    // Add items
    ListViewItem item1 = new ListViewItem("Steve Martin");
    item1.SubItems.Add("Programming .NET");
    item1.SubItems.Add("39.95");

    ListViewItem item2 = new ListViewItem("Irene Suzuki");
    item2.SubItems.Add("VB.NET Core Studies");
    item2.SubItems.Add("69.95");

    ListViewItem item3 = new ListViewItem("Ricky Ericsson");
    item3.SubItems.Add("Passing Your .NET Exams");
    item3.SubItems.Add("19.95");

    // Add the items to the ListView.
    listView.Items.AddRange(
                            new ListViewItem[] {item1, 
                                                item2, 
                                                item3}
                            );
  }

  public static void Main() {
    ListView1 form = new ListView1();
    Application.Run(form);
  }
}
  • 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-05-17T22:45:40+00:00Added an answer on May 17, 2026 at 10:45 pm

    Actually you don’t need that much of your previous knowledge of MFC to implement ListView. C++ under .NET (in layman terms means WinForm applications), you can almost seamlessly translate C# code to C++. If I understood your question correctly, what you need to do is to make sure how objects and properties are accessed in C++ if you are developing a winforms app. Like in C# if you have Object.function, in C++ you may need to write Object::function, this is just an example. Definitely you would need to some more in depth knowledge to run things seamlessly.

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

Sidebar

Related Questions

We've got two developers on the same closed (ugh, stupid gov) network, Another developer
Got a bluescreen in windows while cloning a mercurial repository. After reboot, I now
Got a problem with ADOMD.NET 8.0, SQL2008 and our app. It isn't giving us
I got a webserver with a running application. There's a webpage with a form:
got a new blog at wordpress few days ago ( http://ghads.wordpress.com ) and I
Got a class that serializes into xml with XMLEncoder nicely with all the variables
Got myself in a bit of a pickle here ... working on a CMS
Got a bit of a mind freeze at the moment. I have the following
I got into a mini-argument with my boss recently regarding project failure. After three
I got this error today when trying to open a Visual Studio 2008 project

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.