HiAnother possibility would be to utilize 'case', like this:Code: Pascal [Select][+][-]var x: integer;begin case IsFirst of false: begin for x:= ControlCount-1 downto 0 do if Controls[x].Name = 'Memo1' then exit(Controls[x]); end; true: begin for x:= 0 to ControlCount-1 do if Controls[x].Name = 'Edit1' then exit(Controls[x]); end end; Result:= nil; fPresenter.Provider.NotifySubscribers(prStatus,nil,Str2Pch('(!) Attention: Control was not found! '));end; I hope you get the gist of the algorithm, 'cause I really don't wanna mess with your caps-locked-code...Regards Benny