title: Displaying Data after reading from text file - C#,Visual Studio
body: <p>I have a text file with data which might look something like:</p>
  
  <blockquote>
    <p>UserName</p>
    
    <p>Address</p>
    
    <p>PostCode</p>
    
    <p>PhoneNumber</p>
  </blockquote>
  
  <p>The first four elements of the textfile belongs to one user, the next four to next user etc. I want to read from a textfile, and display data of each user. Reading and distinguishing data of each user is fine.
    The problem is how would I display the data as such? I would like to display the data as a table or something along the line, where each user has a row. Say I want to display data like;</p>
  
  <blockquote>
    <p>Name - Address - Postcode - PhoneNumber</p>
    
    <p>Matt -  15 The -  PO30 78 -  088997655 </p>
    
    <p>Mike -  16 The -  PO31 78 -  088998955</p>
  </blockquote>
  
  <p>If I was using a database I guess you can easily display it with a GridView, is there anyway to display it after reading from textfile?</p>
  
  <p>Many Thanks,
  Mike</p>
  
  <p>EDIT:
  I copied the code you gave, dragged a gridView to the page. Changed it's ID to dataGridView1</p>
  
  <pre><code>DataTable table = new DataTable();
     table.Columns.Add("UserName", typeof(string));
          table.Columns.Add("Address", typeof(string));
          table.Columns.Add("PostCode", typeof(string));
          table.Columns.Add("Name", typeof(string));
          table.Columns.Add("LastName", typeof(string));
          dataGridView1.DataSource = table;
      table.Rows.Add(Label8.Text, Label4.Text, Label5.Text, Label6.Text, Label7.Text);
  </code></pre>