Autor Beitrag
stigge
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 04.02.07 15:39 
Ich habe da eine Frage:

Die Datei, die im OpenDialog ausgewählt wurde, deren Pfad soll in der Variablen 'pfad' gespeichert werden. Wie geht das? Ich habe es schon hinbekommen, das man nur mp3-Dateien auswählen kann aber noch nicht, was passieren soll, wenn man eine Datei ausgewählt hat.

Kurz gesagt, ich will nur wissen, wie man den Pfad der ausgewählten Datei in der Variablen 'pfad' vom Typ string speichern kann. Kann mir jemand helfen?
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 04.02.07 15:42 
Take that:
ausblenden Delphi-Quelltext
1:
2:
3:
if OpenDialog1.Execute then begin
  pfad := OpenDialog1.FileName;
end;

Gruß
alias5000

_________________
Programmers never die, they just GOSUB without RETURN
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 04.02.07 15:44 
ausblenden Delphi-Quelltext
1:
2:
if Opendialog1.Execute then // d.h. der Nutzer hat nicht Abbrechen oder so gedrückt
  ShowMessage('Sie haben die Datei ' + OpenDialog1.Filename + ' ausgewählt.');


Oder, wenn man auch mehrere Dateien auswählen kann:
ausblenden Delphi-Quelltext
1:
2:
3:
if Opendialog1.Execute then
  for i := 0 to OpenDialog1.Files.Count-1 do
    ShowMessage('Sie haben die Datei ' + OpenDialog1.Files[i] + ' ausgewählt.');

_________________
We are, we were and will not be.
stigge Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 426

WinXP
Delphi 2007
BeitragVerfasst: So 04.02.07 15:50 
So schnell hat sich noch nie eine Frage von mir geklärt. Danke!