title: Importing a file with "," as delimiter
body: <p>The file im trying to read is looking like this:</p>
  
  <p>123,123,123h123m,123,123,123</p>
  
  <p>And I have following code to try to read that:</p>
  
  <pre><code>public DataTable DataTableFromTextFile(string location, char delimiter = ',')
  {
      DataTable result;
  
      string[] LineArray = File.ReadAllLines(path);
  
      result = FormDataTable(LineArray, delimiter);
  
      return result;
  }
  
  private static DataTable FormDataTable(string[] LineArray, char delimiter)
  {
      DataTable dt = new DataTable();
  
      AddColumnToTable(LineArray, delimiter, ref dt);
  
      AddRowToTable(LineArray, delimiter, ref dt);
  
      return dt;
  }
  
  private static void AddRowToTable(string[] valueCollection, char delimiter, ref DataTable dt)
  {
  
      for (int i = 1; i &lt; valueCollection.Length; i++)
      {
          string[] values = valueCollection[i].Split(delimiter);
          DataRow dr = dt.NewRow();
          for (int j = 0; j &lt; values.Length; j++)
          {
              dr[j] = values[j];
          }
          dt.Rows.Add(dr);
      }
  }
  
  private static void AddColumnToTable(string[] columnCollection, char delimiter, ref DataTable dt)
  {
      string[] columns = columnCollection[0].Split(delimiter);
      foreach (string columnName in columns)
      {
          DataColumn dc = new DataColumn(columnName, typeof(string));
      }
  }
  </code></pre>
  
  <p>but it does not seem to work yet. I have tried changing some things but it then went to adding blank spaces into the DataGridView (which is called infoTabelle).
  Anyone able to help me fix my problem?</p>
  
  <p>****EDIT
  Got it all fixed now. I changed the method where it was to put my seperated text into the DataGridView. Working like a charm now.**</p>