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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:12:58+00:00 2026-06-19T00:12:58+00:00

I have a similar requirement to this post… Populate Gridview at runtime using textfile

  • 0

I have a similar requirement to this post…
Populate Gridview at runtime using textfile

Where I want to read a text file with StreamReader and populate a DataTable with the data in the file, however I’m not sure how to implement a split() with a tab.

Could anybody point me in the right direction, please?

  • 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-19T00:12:59+00:00Added an answer on June 19, 2026 at 12:12 am

    You can try this:

            DataTable table = new DataTable();
            table.Columns.Add("col1");
            table.Columns.Add("col2");
            table.Columns.Add("col3");
    
            var lines = File.ReadAllLines(@"Data.txt").ToList();
            lines.ForEach(line => table.Rows.Add(line.Split((char)9)));
    

    I presumed that rows are delimited by newline (if that’s the case ReadAllLines method can be used). Number 9 is the ASCII value for horizontal tab character and it is used for splitting the line. ForEach is a method that can be used on generic lists, it is there instead of the foreach loop.

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

Sidebar

Related Questions

I have a requirement to add commenting system to a page (similar to 'Post
I have a requirement similar to facebook's send message To: text field wherein after
I have a similar challenge to this post: Batch insert/update with entity framework from
I have a requirement like this and something similar to that has been implemented
Do we have similar windows API of DebugBreak in Unix/ Linux. I want to
I know there are other questions that have similar issues, but I have read
I have a question very similar to this, How do you build extensible data
I am having similar requirement as this: Convert time in HH:MM:SS format to seconds
I am new to XSLT and have a similar requirement to Line Break in
I have a problem similar to this question: Wicket: can Checkgroup be Ajax enabled?

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.