Autor Beitrag
BlackPhantom
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 144

Win 2000, Win XP, UNIX
D7 Prof, C, HTML, VB 5
BeitragVerfasst: Do 01.05.03 16:49 
Hi@all

Ist zwar eine Newbe-Frage aber trotzdem könnte einer mir dabei helfen:

Ich habe eine Kombo-Box mit drei Items. Je nachdem welches Item ausgesucht wurde soll die dazu entsprechende Combobox entstehen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm2.CB_LigaSelect(Sender: TObject);
begin

  If CB_Liga.Text ='Deutschland - Bundesliga' then
    CB_Deutschland_Mannschaft.visible:=True;
    CB_England_Mannschaft.visible:=False;
    CB_Italien_Mannschaft.Visible:=False;

    IF CB_Liga.text='Italien - Seria A' then
    CB_Deutschland_Mannschaft.visible:=False;
    CB_England_Mannschaft.visible:=False;
    CB_Italien_Mannschaft.Visible:=True;

end;


Wieso zeigt er mir die Combobox "CB_Italien_Mannschaft" an obwohl ich auf Deutschland oder England geclickt habe?

thx4all
MFG
BlackP
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 01.05.03 16:55 
Weil Du da einige BEGIN und END vergessen hast. "CB_Italien_Mannschaft.Visible:=True;" wird immer ausgeführt!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
BlackPhantom Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 144

Win 2000, Win XP, UNIX
D7 Prof, C, HTML, VB 5
BeitragVerfasst: Do 01.05.03 16:59 
Oh hab ich wohl vergessen....ich kann mich dunkel daran erinnern, dass man irgendwann die ENDs und BEGINs bei If-Anweisungen weglassen kann. Weißt du zufällig wann?
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Do 01.05.03 17:00 
nur wenn Du danach einen anderen Block danach hat, z.B. eine for-Schleife oder with-Block.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 01.05.03 17:02 
Wenn nur eine einzelne Anweisung folgt, kannst Du die BEGINs und ENDs weglassen. Du solltest Dir diesen Beitrag einmal anschauen, er könnte sehr hilfreich für Dich sein! Außerdem stammt er von mir, was natürlich das schlagkräftigste Argument ist, warum Du den Beitrag lesen solltest. :wink:

//edit: ja, die einzelne Anweisung kann auch ein while-, with- oder For-Block sein, denn das ist ja eigentlich auch eine einzelne Anweisung. Repeat-Until auch. Was vergessen?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
BlackPhantom Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 144

Win 2000, Win XP, UNIX
D7 Prof, C, HTML, VB 5
BeitragVerfasst: Do 01.05.03 17:06 
Danke werde mir mal den Beitrag anschauen.....thx4all@both