Hello! Tell me how to set the check file for its extension, for example. Txt?

procedure TForm1.Memo1DragDrop(Sender, Source: TObject; X, Y: Integer); var s:string; begin s:=fileListBox1.Items.Strings[fileListBox1.ItemIndex]; begin memo1.Lines.LoadFromFile(s); showmessage('Файл успешно перемещен'); end else showmessage('Файл не удалось переместить'); end; 

    1 answer 1

    Hey. Try this:

     if (ExtractFileExt(s) = ".txt") then begin showmessage('Расширение файла: txt'); end 
    • one
      In fact, there is a whole family of ExtractFile *** extraction procedures, for example, you can select the path, the file name and its extension. - AseN