Autor Beitrag
MoD17
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 36

WinXP, RedHat 9
D7 pers, D6 pers
BeitragVerfasst: Mo 02.08.04 16:39 
hi!
ich mbin momentan dabei, ein programm zu schreiben, dass als datenbank für musik-alben dienen soll
ich habe ein stringgrid mit Zeile|Interpret|Album|Stil|Jahr|Speicherort
ich kann per combobox und einem button eine neue zeile eintragen, die dann auch einer ini-datei gespeichert wird:
[1] <- zeilennummer
Interpret=a
Album=b
Stil=c
jahr=d
Speicherort=e
[2]
Interpret=f
Album=g
Stil=h
jahr=i
Speicherort=j
die frage ist: wie lese ich eine ini-datei ein, sodass die entsprechenden felder im grid gefüllt werden?
gespeichert wird die liste zeilenweise so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
procedure zeile_speichern;
begin
  ini:=TIniFile.create(ExtractFilePath(ParamStr(0))+
  'nr1.ini');
  ini.WriteString(IntToStr(zeilenanzahl),'Interpret',form1.Grid1.Cells[1,zeilenanzahl]);
  ini.WriteString(IntToStr(zeilenanzahl),'Album',form1.Grid1.Cells[2,zeilenanzahl]);
  ini.WriteString(IntToStr(zeilenanzahl),'Stil',form1.Grid1.Cells[3,zeilenanzahl]);
  ini.WriteString(IntToStr(zeilenanzahl),'jahr',form1.Grid1.Cells[4,zeilenanzahl]);
  ini.WriteString(IntToStr(zeilenanzahl),'Speicherort',form1.Grid1.Cells[5,zeilenanzahl]);
end;

procedure hinzufuegen; // fügt neue zeile in grid1 hinzu, wird per neu_btn aufgerufen
begin
  form1.grid1.cells[1,zeilenanzahl]:=form1.interpret_combo.Text;
  form1.grid1.cells[2,zeilenanzahl]:=form1.album_combo.text;
  form1.grid1.cells[3,zeilenanzahl]:=form1.stil_combo.Text;
  form1.grid1.cells[4,zeilenanzahl]:=form1.jahr_combo.Text;
  form1.grid1.cells[5,zeilenanzahl]:=form1.ort_combo.Text;
  zeile_speichern;
  zeilenanzahl:=zeilenanzahl+1;
end;


gruss
MoD17

ps: wie bekomm ich es hin, dass einträge auch in der dropdownliste der entsprechenden combobox eingetragen werden, wär z.b. bei stil ganz gut, da man nicht immer alles neu eingeben muss?
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Mo 02.08.04 17:11 
Hier wird beschrieben, wie eine INI-Datei aufgebaut ist und wie Daten aus einer INI-Datei gelesen werden.
MoD17 Threadstarter
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 36

WinXP, RedHat 9
D7 pers, D6 pers
BeitragVerfasst: Mo 02.08.04 22:37 
hi
danke! mache mich sofort an die arbeit! :D

gruss
MoD17