Thema: Delphi csv in combobox ausgeben

Einzelnen Beitrag anzeigen

Benutzerbild von SnGtKs
SnGtKs

Registriert seit: 25. Dez 2004
Ort: Bad Liebenwerda
37 Beiträge
 
Delphi 7 Personal
 
#1

csv in combobox ausgeben

  Alt 27. Nov 2005, 10:40
hallo ....

ihr seit doch alle so schlau und könnt mir sicher helfen... ich habe da ein problem bei einem projekt von mir ... ich schreibe gerade ein programm das es ermöglicht tintenpatronen zum refill anzunehmen ... in diesem programm gibt es 4 combobox wo man die patrone auswählen kann ... die combo box einträge habe ich mit Add('HP 15 10,00€); realisiert .... damit das ganze schön aussieht habe ich es mit
Delphi-Quellcode:
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var
  strVal, strAll: string;
  pos1 : Integer;
  rc: TRect;
  arrWidth: array [0..3] of Integer;
begin
  Combobox1.Canvas.Brush.Style := bsSolid;
  Combobox1.Canvas.FillRect(Rect);
  strAll := Combobox1.Items[Index];
  arrWidth[0] := 0;
  arrWidth[1] := 100;
  arrWidth[2] := 200;
  arrWidth[3] := 300;
  rc.Left := Rect.Left + arrWidth[0] + 2;
  rc.Right := Rect.Left + arrWidth[1] - 2;
  rc.Top := Rect.Top;
  rc.Bottom := Rect.Bottom;
  pos1 := Pos(' ', strAll);
  strVal := Copy(strAll, 1, pos1 - 1);
  Combobox1.Canvas.TextRect(rc, rc.Left, rc.Top, strVal);
  Combobox1.Canvas.MoveTo(rc.Right, rc.Top);
  Combobox1.Canvas.LineTo(rc.Right, rc.Bottom);
  rc.Left := Rect.Left + arrWidth[1] + 2;
  rc.Right := Rect.Left + arrWidth[2] - 2;
  strAll := Copy(strAll, pos1 + 1, Length(strAll) - pos1);
  pos1 := Pos(' ', strAll);
  strVal := Copy(strAll, 1, pos1 - 1);
  Combobox1.Canvas.TextRect(rc, rc.Left, rc.Top, strVal);
  Combobox1.Canvas.MoveTo(rc.Right, rc.Top);
  Combobox1.Canvas.LineTo(rc.Right, rc.Bottom);
  rc.Left := Rect.Left + arrWidth[2] + 2;
  rc.Right := Rect.Left + arrWidth[3] - 2;
  strAll := Copy(strAll, pos1 + 1, Length(strAll) - pos1);
  pos1 := Pos(' ', strAll);
  strVal := Copy(strAll, 1, pos1 - 1);
  Combobox1.Canvas.TextRect(rc, rc.Left, rc.Top, strVal);
  Combobox1.Canvas.MoveTo(rc.Right, rc.Top);
  Combobox1.Canvas.LineTo(rc.Right, rc.Bottom);
  strAll := Copy(strAll, pos1 + 1, Length(strAll) - pos1);
end;
getrennt ...

nun zu meinem problem ... ich muss ja alle patronen mit Add(HP 15 10,00€); eingeben und nun habe ich mir so gedacht ich schreibe die ganzen patronentypen und den preis in eine csv datei und lese die wieder ein ... doch habe ich davon keinen plan wie man das machen könnet ...

Delphi-Quellcode:
with Combobox1.Items do
begin
Add('HP 14 10,00€ ');
Add('HP 17 10,00€ ');
Add('HP 23 10,00€ ');
Add('HP 28 10,00€ ');
Add('HP 41 10,00€ ');
Add('HP 49 10,00€ ');
Add('HP 57 10,00€ ');
Add('HP 78 15,00€ ');
Add('HP 343 10,00€ ');
Add('HP 344 10,00€ ');
Add('HP 14 10,00€ ');
Add('HP 15 10,00€ ');
Add('HP 20 10,00€ ');
Add('HP 26 10,00€ ');
Add('HP 27 10,00€ ');
Add('HP 29 10,00€ ');
Add('HP 33 10,00€ ');
Add('HP 45 10,00€ ');
Add('HP 56 10,00€ ');
Add('HP 58 10,00€ ');
Add('HP 338 10,00€ ');
Add('HP 339 10,00€ ');
Add('Lexmark 19 10,00€ ');
Add('Lexmark 20 10,00€ ');
Add('Lexmark 26 10,00€ ');
Add('Lexmark 27 10,00€ ');
Add('Lexmark 60 10,00€ ');
Add('Lexmark 80 10,00€ ');
Add('Lexmark 83 10,00€ ');
Add('Lexmark 90 10,00€ ');
Add('Lexmark 16 10,00€ ');
Add('Lexmark 17 10,00€ ');
Add('Lexmark 48 10,00€ ');
Add('Lexmark 50 10,00€ ');
Add('Lexmark 70 10,00€ ');
Add('Lexmark 82 10,00€ ');
Add('Canon M-6   10,00€ ');
Add('Canon BCI-21 10,00€ ');
Add('Canon C-6 10,00€ ');
Add('Canon Y-6 10,00€ ');
Add('Canon BCI-24c 10,00€ ');
Add('Canon PC-6 10,00€ ');
Add('Canon M-3e 10,00€ ');
Add('Canon PM-6 10,00€ ');
Add('Canon Y-3e 10,00€ ');
Add('Canon BC-05 10,00€ ');
Add('Canon C-3e 10,00€ ');
Add('Canon BK-6 10,00€ ');
Add('Canon BCI-21 10,00€ ');
Add('Canon BCI-10 10,00€ ');
Add('Canon BCI-11 10,00€ ');
Add('Canon BCI-24bk 10,00€ ');
Add('Canon BCI-3eBK 10,00€ ');
Add('Canon BX-3 10,00€ ');
Add('Canon BC-02 10,00€ ');
Add('Canon BC-20 10,00€ ');
Add('Canon BC-60 10,00€ ');
Add('unbekannt _ 10,00€ ');
Add('unbekannt _ 15,00€ ');
end;
diese einträge möchte ich in einer csv datei "auslagern" so dass man die später ohne probleme mit einem editor erweitern kann

wäre cool wenn jemand ne idee hätte
Sebastian Quaß
  Mit Zitat antworten Zitat