Autor Beitrag
ghhe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46



BeitragVerfasst: So 25.01.04 14:50 
Hi

also mein problem is folgendes: ich will in einer combobox einen eintrag selectieren ... allerdings will ich das er zb das item 'test' selectiert wird geht das irgendwie? gibts dafür was? also wenn man die form aufruft soll bei der combobox ein eintrag automatisch selectiert (und angezeigt) werden.

MfG ghhe
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: So 25.01.04 14:55 
ausblenden Delphi-Quelltext
1:
ComboBox1.Items[ComboBox1.ItemIndex]					


liefert Dir das aktuell ausgewählte Item und mit

ausblenden Delphi-Quelltext
1:
Combobox1.Itemindex:=0					


zeigst Du das erste Element in der Combobox an (falls es eines gibt)
ghhe Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46



BeitragVerfasst: So 25.01.04 14:58 
jo eben und das klappt nicht ... er zeigt mir leider das element nicht an =( es bleibt alles beim alten .. leere combobox und drunter die normalen items ... aber dann muss ich schaun wo da ein fehler ist ... danke auf jeden fall
MaxiTB
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 679

Win2000, WinXp, Workbench ;-)
D7 Ent, VS2003 Arch.
BeitragVerfasst: So 25.01.04 17:29 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if Comobox1.Items.Count=0 then
 Combobox1.Text:=''
else
 Combobox1.Text:=Combobox.Items[0];

Hilft immer ... aber auch die andere Methode müßte eigentlich gehen ...

Wenn nicht, dann wird diese Methode vielleicht nicht aufgerufen oder später wird ein anderer Wert zugewiesen. Ein Breakpoint würde dir hier weiterhelfen.

_________________
Euer Mäxchen
Wer früher stirbt, ist länger tot.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 25.01.04 19:01 
dieser code such in der combobox nach dem item test und markiert es.
das ist doch das was du willst oder ?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var i:integer;
begin
     for i := 0 to combobox1.Items.Count -1 do begin
         if combobox1.Items [i] = 'test' then
            combobox1.ItemIndex := i;
     end;
end;

_________________
In the beginning was the word.
And the word was content-type: text/plain.