title: How to open a html table file into a (string)grid using Lazarus?
body: <p>I'm new here so feel free to give feedback on my way of asking.</p>
  <p>For a project at school I need to open html files with tables in a stringgrid using Lazarus. My teacher said I need to use <code>pos</code> to locate the html tags, and using <code>&lt;th&gt;</code> and <code>&lt;tr&gt;</code> I should be able to define the rows and columns, but I find it very difficult.</p>
  <p>I'm not that far with this problem, I'm stuck at an early step. I'm trying to look if my <code>pos</code> is working, but it doesn't really. My idea: clicking on <code>Button1</code> will open <code>OpenDialog1</code>. Then I choose a html file and my program will search for the text in <code>Pos('&lt;th', filename)</code> (see the included code). The position of that text will be put in <code>Label1</code>.</p>
  <p>I get this error:</p>
  <p><code>unit1.pas(46,30) Error: Incompatible type for arg no. 2: Got &quot;TStringList&quot;, expected &quot;Variant&quot;</code></p>
  <p>So my subquestion is: How can I use <code>pos</code> in a file?</p>
  <p>This is the code I use. Feel free to ask and give feedback. Thanks in advance!</p>
  <pre><code>procedure HtmlToGrid(Grid: TStringGrid; const FileName: string; Sender: TObject);
  var
    TextFile, Line: TStringList;
    Row: Integer;
    Col: Integer;
    prob: Integer;
  begin
    Grid.RowCount := 0;  //clear any previous data
    TextFile := TStringList.Create;
    Textfile.LoadFromFile(filename);
    prob := Pos('&lt;th', TextFile);
    if (Sender is TLabel) then
      TLabel(Sender).Caption := IntToStr(prob);
  
  end;
  
  procedure TForm1.Button1Click(Sender: TObject);
  var filename : string;
  begin
    if OpenDialog1.Execute then begin
      filename:= OpenDialog1.FileName;
      HtmlToGrid(database, filename, Label1);
    end;
  
  end;
  </code></pre>