Einzelnen Beitrag anzeigen

FaNIX

Registriert seit: 8. Okt 2007
36 Beiträge
 
#1

Check if instance exist?

  Alt 29. Okt 2007, 08:37
Hi,

In delphi, how do i check if a instance of a class has already been created or not?

Something like this in VB:

Delphi-Quellcode:
        If (FtpClient Is Nothing) Then
            Return
        End If
I want to check if the Fo_FtpClient has already been created or not: Here is my code:

Delphi-Quellcode:
unit u_fdn_FTP_Dot_Net;

interface

uses
    System.Net,
    System.Net.Sockets,
    System.Text,
    System.IO,
    Borland.Vcl.Classes,
    Borland.Vcl.StrUtils,
    Borland.Vcl.SysUtils,
    Borland.Vcl.Dialogs,
    TKFP.IO,
    TKFP.Net;

type
    TFtp_Dot_Net = class(TObject)
    private
        [b]Fo_FtpClient : TKFP.Net.FtpClient;[/b]
Then before creating it again in the onclick event, i first want to check if it doesnt already exist:

Fo_FtpClient := FtpClient.Create(oLogon,Address,21);
  Mit Zitat antworten Zitat