Autor Beitrag
gih9
Hält's aus hier
Beiträge: 14

Win2000
D5 Prof.
BeitragVerfasst: Di 30.03.04 13:18 
Hallo,
mein Problem ist folgendes. Ich hab 2 ComboBoxes dir wie folgt mit items gefüllt sind:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ComboBox1.Text := '';
  ComboBox2.Text := '';
  ComboBox1.Items.Add('1');
  ComboBox1.Items.Add('2');
  ComboBox2.Items.Add('1');
  ComboBox2.Items.Add('2');
end;

Nun hab ich auch noch folgende Procedure:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.Text = ComboBox2.Text then
ComboBox1.Text := ''
end;

Mein Ziel ist es dass wenn in der zweiten ComboBox ein Wert ausgewählt wird dass derselbe Wert dann nich auch in der ersten ComboBox sein kann. Wenn ich einen Wert manuell eingebe dann funktionierts, wähle ich den Wert jedoch aus dem Pulldown Menü dann kommt der Wert trotzdem hinstehen.

Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Di 30.03.04 14:11 
Bitte löschen... Hab mich verlesen sorry...

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce


Zuletzt bearbeitet von Chatfix am Di 30.03.04 14:19, insgesamt 1-mal bearbeitet
gih9 Threadstarter
Hält's aus hier
Beiträge: 14

Win2000
D5 Prof.
BeitragVerfasst: Di 30.03.04 14:15 
Nee, da hgeb ich mich wohl nicht gut ausgedrückt.
Es darf nicht geschehen dass in der ersten das gleiche steht wie in der zweiten. d.h. wenn in der zweiten '2' steht und ich wähle in der ersten '2' aus dann soll in die erste ein empty string stehen kommen.
ausblenden Delphi-Quelltext
1:
2:
if ComboBox1.Text = ComboBox2.Text then 
ComboBox1.Text := ''

das geschieht jedoch nicht. und ich verstehe nicht warum es nicht funzt...
hallo
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 450

WIN XP, SuSE 9.3
D3 Prof, D6 Pers, 2005 Pers
BeitragVerfasst: Di 30.03.04 14:26 
ACHTUNG: Mit Text erreichst du hier nichts.
Du kannst nur über Combobox1.items auf den Inhalt zugreifen!
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Di 30.03.04 14:42 
OK, hab mal ne lösung gebastelt, bei mir hat sie funktioniert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  if ComboBox1.Items[ComboBox1.ItemIndex] = ComboBox2.Items[ComboBox2.ItemIndex] then
    ComboBox1.ItemIndex := -1;
end;

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
gih9 Threadstarter
Hält's aus hier
Beiträge: 14

Win2000
D5 Prof.
BeitragVerfasst: Di 30.03.04 14:50 
So geht's. War nicht schwer :?
Man muss nur drauf kommen...