title: C# Read .txt file, store its data and edit the file
body: <p>I am trying to do something pretty simple. I am making a Windows Form Application, it's a simple 'Student grade calculator' essentially. I have the form working, it can read the file and show its data in a text box. However, I need to store each line's columns in their own fields.</p>
  
  <p>You can see below an example of a file it should read/edit/save.</p>
  
  <p><a href="https://i.stack.imgur.com/mu76U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mu76U.png" alt="enter image description here"></a></p>
  
  <p>This is what I currently have that I use to read in a file:</p>
  
  <pre><code>      private void LoadFile()
      {
          string lineFromFile;
  
          fileContentTextBox.Clear();
  
          try
          {
              using (StreamReader reader = new StreamReader(fileName))
              {
                  while (!reader.EndOfStream)
                  {
                      lineFromFile = reader.ReadLine();
  
                      fileContentTextBox.AppendText(lineFromFile);
  
                      fileContentTextBox.AppendText(Environment.NewLine);
                  }
              }
  </code></pre>
  
  <p>So, how would I be able to store its data in fields such as:</p>
  
  <ul>
  <li>moduleCode1 "SOFT152"</li>
  <li>examWeighting1 "0.3"</li>
  <li>courseworkeMark1 "65"</li>
  <li>etc..</li>
  </ul>
  
  <p>I know that you have to use something like this, but I'm not sure how to use it in this situation where I need to store the file's data in many individual fields?</p>
  
  <pre><code>    lines[i].Split(',')
  </code></pre>
  
  <p>The output in the form would look something like this in the end:</p>
  
  <p><a href="https://i.stack.imgur.com/c6s0P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c6s0P.png" alt="enter image description here"></a></p>
  
  <p>If there is a better way of doing this, like taking each line into a string and then separating it or something please let me know.</p>