![]() |
Ist an dem Code was falsch?
Hi,
kann es sein das in dem Code ein Fehler drin ist?
Delphi-Quellcode:
Das ganze funktioniert nämlich nicht ganz.
function FindChannelWindow(channel: string; server: Tserverform): Tmsgform;
var i: Integer; begin for i := 0 to Application.ComponentCount-1 do begin if (Application.Components[i] is Tmsgform) then begin if ((Application.Components[i] as Tmsgform).channel = channel) and ((Application.Components[i] as Tmsgform).Server = server) then Result := (Application.Components[i] as Tmsgform); end; end; end; MFG Chris. |
Re: Ist an dem Code was falsch?
So direkte fehler sehe ich jetzt nicht, jedoch solltest du Result zuerst einen Default-Wert zuweisen:
Delphi-Quellcode:
function FindChannelWindow(channel: string; server: Tserverform): Tmsgform;
var i: Integer; begin Result:=nil; for i := 0 to Application.ComponentCount-1 do if Application.Components[i] is Tmsgform then if (Tmsgform(Application.Components[i]).channel = channel) and (Tmsgform(Application.Components[i]).Server = server) then Result:=Tmsgform(Application.Components[i]); end; |
Re: Ist an dem Code was falsch?
Hi!
Zitat:
Ciao Frederic |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:12 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz