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

The Archive Base Latest Questions

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

I want to read some specific information from a .txt file and display that

  • 0

I want to read some specific information from a .txt file and display that particular lines inside a TextBox in a c# form application. The .txt file template looks like this:

info1: some characters here…

info2: some characters here…

info3: some characters

   Col1  Col2  Col3  Col4  Col5   Col6   Col7   Col8   Col9  
  <h1> ---------------------------------------------------------------  

   001   a      b     c    d      e       f       g      h  
   001   c      a     f    d      f       b       e      t  
   001   a      b     c    d      e       f       g      h  

   002   c      a     f    b      f       b       e      t  
   002   z      e     f    d      f       b       e      m          
   002   c      a     j    u      t       b       h      t  
   002   y      l     f    d      f       b       n      t  

   006   c      a     j    y      t       b       d      t   

   007   b      a     f    d      r       b       t      t  
   007   c      a     f    r      f       b       e      q  
   007   c      a     f    d      f       x       z      t  
   007   c      p     f    d      s       b       a      t  
   007   c      a     f    h      f       b       e      p  

   <h1>----------------------------------------------------------------  

Additional info: numbers of lines similar to info3 is not fixed;

The functionality I need is to insert in a TextBox a the group of numbers which will correspond to the first columns (eg. 001) , And then display in another text box the header information of the file, the columns titles, and after that, Only the lines which starts with the number introduced excluding the others. How should a good solution for that would be?
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-05-25T10:48:44+00:00Added an answer on May 25, 2026 at 10:48 am

    In this case you should use String.StartsWith

    Example:

    using (var reader = new System.IO.StreamReader(@"C:\file.txt"))
    {
        while (!reader.EndOfStream)
        {
            var line = reader.ReadLine();
    
            if (line.StartsWith("info"))
            {
                // do something
            }
        }
    
        reader.Close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my grails application I want to read some values from properties file and
I want to simply read some JSON data from a URL, then turn that
I have a .txt file having some text. I want to read this file
I have a huge binary file from which I want to read some bytes
I want to interrupt some specific grails domain class events(read,write,delete,update).Is there any hibernate eventlistner
I want to read some nodes of a XML file and show their values
I want to make a program that will read some number in string format
i want to read an html file by using jquery get function, replace some
I heard from someone that DSL is really powerful in some specific fields. So
I want to read/retrieve some details from a single YouTube video using: $sxml= simplexml_load_file(http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ);

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.