title: Delphi Text File and Array
body: <p>I have the following Scenario: In a textfile (justin#us883) the program must extract the password - us883 check if the password typed in is correct to the one in the list and then make a button visible to enter program: Code that is not working:</p>
  
  <pre><code>var  
    textf:textfile;
    oneline,spass,scheck :string;
    place,i,icount :integer;
    Arrpass : array[1..Maxnames] of string;
  begin
    scheck := edtpass.Text;
    assignfile(textf,'Userlist.txt');
    reset(textf);
    if fileExists('Userlist.txt')= false then 
      exit;
    while not eof(textf) do
    begin
      Readln(textf, oneline);
      place  := pos('#',oneline);
      delete(oneline,1,place);
      spass := copy(oneline,1,place-1);  // get the us883
  
      Arrpass[i] := spass;
  
      for i := Low(Arrpass) to High(Arrpass) do
        if Arrpass[i] = spass then
        begin
          btnenter.Visible := true
        end
        else
          btnenter.Visible := False;
      Showmessage('Wrong Password');
  
    end;
    closefile(textf);
  
  end;
  </code></pre>