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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:56:48+00:00 2026-05-25T05:56:48+00:00

I want to write an application that will display data from a CSV file.

  • 0

I want to write an application that will display data from a CSV file.

I thought it would be easiest to use a listbox to do this.

I’m just not sure how to define the data template in order to accommodate as many columns as the csv wishes to define. Is there a way to define the number of columns in, say, a grid based on maybe the item count in a list?

  • 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-25T05:56:49+00:00Added an answer on May 25, 2026 at 5:56 am

    Use a ListView rather than a ListBox, then you can use a GridView for the columns, or you could use a DataGrid which additionally can create columns automatically based on the data it gets, this requires properties though, which are not as nice to create on the fly.

    I would suggest you parse the data into array objects and you create the columns by iterating over its length. Adding bindings like this: new Binding("[" + i + "]").

    Here’s a rough outline:

    <ListView Name="csvLv"/>
    
    var view = new GridView();
    csvLv.View = view;
    using (var reader = new StreamReader(@"PathGoesHere.csv"))
    {
        //This is just a sketch and all the data extraction depends on your format
        var lines = reader.ReadToEnd()
            .Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
            .Select(x => x.Split(',')).ToArray();
        var headers = lines[0];
        var data = lines.Skip(1);
        for (int i = 0; i < headers.Length; i++)
        {
            view.Columns.Add(new GridViewColumn()
            { 
                Header= headers[i],
                DisplayMemberBinding = new Binding("[" + i + "]")
            });
        }
        csvLv.ItemsSource = data;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write an Android application that can display some data received(polled) from
I want to write a new application that will use a DBMS. In the
Say, I want to write a desktop application that will heavily use SVG. What
I want to write an application that removes data from a hard drive. Are
I want to write an application in Java that will communicate with Google App
I want to write an application that will be running on several phones (android,
I want to create a console application that will display the key that is
I want to write an application for Android devices that interacts with the surface
I want to write a web application and want to use Ruby. I have
I want to write a file where an external application can read it, but

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.