Din ListBox hedder ListBox og din Edit hedder Edit:
procedure TForm1.FormActivate(Sender: TObject); var fname : string; begin fname:=ExtractFilePath(Application.ExeName)+'\import\*.*'; SendMessage(ListBox.Handle, LB_DIR, DDL_DIRECTORY,LongInt(fname)); end;
procedure TForm1.ListBoxClick(Sender: TObject); var sr : TSearchRec; Path : string; begin Path:=ListBox.Items[ListBox.ItemIndex]; Path:=Copy(Path,2,Length(Path)-2); Path:=ExtractFilePath(Application.ExeName)+'\import\'+Path+'\*.txt'; if FindFirst(Path,faAnyfile,sr)=0 then Edit.Text:=sr.Name else Edit.Text:='Ingen txt fil'; FindClose(sr); end;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.