Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi In DBComboBox schreiben? (https://www.delphipraxis.net/49044-dbcombobox-schreiben.html)

Grolle 4. Jul 2005 20:31


In DBComboBox schreiben?
 
Hallo!
Ist es möglich direkt in eine DBComboBox zu schreiben?

Taladan 4. Jul 2005 20:42

Re: In DBComboBox schreiben?
 
Wie genau meinst du das? Natürlich kannst du die Werte per Code setzen.
Bin mir nicht ganz sicher obs der Value-Wert ist. Aber gehen tuts
Lange ist es her, das ich noch mit echten DB´s gearbeitet hab und mein Delphi unterstützt das im Moment nicht :-(

Delphi-Quellcode:
DBComboBox.Value := 'Irgendwas'

Grolle 4. Jul 2005 20:47

Re: In DBComboBox schreiben?
 
Hi1
Ich möchte die ComboBox genau wie eine EditFeld benutzen, nur
das die Einträge in ihr bestehen bleiben.

marabu 4. Jul 2005 20:51

Re: In DBComboBox schreiben?
 
Vielleicht reicht dir schon das:

Delphi-Quellcode:
DBComboBox.Style := csDropDown;
Grüße vom marabu

Grolle 4. Jul 2005 21:12

Re: In DBComboBox schreiben?
 
Hi!
Die DBComboBox steht schon auf csDropDown.
Damit kann ich in die ComboBox schreiben.
Der Eintrag wird dann aber nicht automatisch
übernommen. :?

marabu 4. Jul 2005 21:34

Re: In DBComboBox schreiben?
 
Zitat:

Zitat von Grolle
Der Eintrag wird dann aber nicht automatisch übernommen.

Natürlich nicht.
Initialisiere die DBComboBox.Items im Form.OnCreate() und setze Sorted auf TRUE. Im Dataset.OnAfterPost() pack das rein:

Delphi-Quellcode:
with DBComboBox do
    if Items.IndexOf(Text) = -1 then
      Items.Add(Text);
marabu


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:03 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz