Comment faire pour que les Items d'un Listbox soient égal aux noms des sections d'un fichier INI ?
Merci beaucoup !
Comment faire pour que les Items d'un Listbox soient égal aux noms des sections d'un fichier INI ?
Merci beaucoup !
Salut!!
J'ai pas tester mais ca devrait etre un truc dans ce genre la:
@+
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 var ASections: TStrings; AIniFile: TIniFile; begin (...) AIniFile.ReadSections(ASections); For I := 0 to ASections.Count - 1 do ListBox.AddItem(ASections[I], nil); (...) end;
comment l'intégrer ici ? j'ai pas compris :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 unit Unit4; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm4 = class(TForm) ListBox1: TListBox; Button1: TButton; procedure FormCreate(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var Form4: TForm4; implementation {$R *.dfm} procedure TForm4.FormCreate(Sender: TObject); var repertory : string; begin repertory:=ExtractFilePath(Application.ExeName)+'classe_classes.ini'; listbox1.items:= ?? end; end.
Pour plus d'info, consulte l'aide !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 unit Unit4; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm4 = class(TForm) ListBox1: TListBox; Button1: TButton; procedure FormCreate(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var Form4: TForm4; implementation {$R *.dfm} procedure TForm4.FormCreate(Sender: TObject); var repertory : string; ASections: TStrings; AIniFile: TIniFile; begin repertory:=ExtractFilePath(Application.ExeName)+'classe_classes.ini'; AIniFile := TIniFile.Create('classe_classes.ini'); Try AIniFile.ReadSections(ASections); For I := 0 to ASections.Count - 1 do ListBox.AddItem(ASections[I], nil); Finally AInifile.Free; end; end; end.
@+
Partager