Extracting Filenames from OpenDialog strings list/files? lazarus / 13-General ---------------------------------------------------------------------- MisterKode · 2008-11-10 13:24 Hi everyone! This is my first post, and first time writing a program in Lazarus after using Delphi 4 years ago, so a bit rusty...loving it in Lazarus so far! I'm trying extract the file names from an OpenDialog into a ListBox; I've managed to assign the files just plain to the ListBox as below but can't remember for the life of me how to extract the filenames from EACH STRING and pass it to the ListBox ... can anyone help please? Code: [Select] procedure TForm1.OpenImagesDLGClose(Sender: TObject); begin   ImagesLBX.Items := OpenImagesDLG.Files; end; Also is there a good reference site with the properties, procedures, events, etc for each of the components in the LCL? Time for me to dig my Pascal books out of storage again! :lol: Thanks in advance! Carl ---------------------------------------------------------------------- Leledumbo · 2008-11-10 13:46 Quote... how to extract the filenames from EACH STRING and pass it to the ListBox ... can anyone help please? Code: [Select] ImagesLBX.AddStrings(OpenImagesDLG.Files); QuoteAlso is there a good reference site with the properties, procedures, events, etc for each of the components in the LCL? http://lazarus-ccr.sourceforge.net/docs/lcl You can also download it (along with rtl and fcl) here. ---------------------------------------------------------------------- MisterKode · 2008-11-11 01:35 Thanks Leledumbo, found it was Code: [Select] ImagesLBX.Items.AddStrings(OpenImagesDLG.Files); but that's ok. The problem now is, how do I extract the FILE NAME from each string in the list and only put the file name into the Listbox instead? Do I need to pass that procedure to an array or something like that? If someone could help, I'd be most grateful Thanks Carl ---------------------------------------------------------------------- Leledumbo · 2008-11-11 03:36 Oops, sorry! QuoteThe problem now is, how do I extract the FILE NAME from each string in the list and only put the file name into the Listbox instead? You can use ExtractFileName before adding them to the listbox. Something like: Code: [Select] with OpenImagesDLG.Files do // just for shorter typing   for i:=0 to Count-1 do     Strings[i]:=ExtractFileName(Strings[i]); ImagesLBX.Items.AddStrings(OpenImagesDLG.Files);