GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / DisplayFromFTP Method / DisplayFromFTP(String,String,String) Method
The full URI path with the full document name, where the file is located, for example ftp://ftp.mywebsite.com/mydocument.pdf.
The user's login required to authenticate on the server.
The user's password required to authenticate on the server.
Example





In This Topic
DisplayFromFTP(String,String,String) Method
In This Topic
Loads a document from a file stored on a distant server using FTP transfer according to what you have specified and subsequently displays it in the GdViewer control. The file transfer will be run asynchronously. The document previously displayed in the control will automatically close.

All document formats currently supported by the toolkit are listed here.

The DataReceived event is raised to allow you to monitor the transferred data. Likewise, the TransferEnded event is raised right after the transfer will finish.

You can also control displaying the progress bar by enabling or disabling the EnabledProgressBar property.

Syntax
'Declaration
 
Public Overloads Function DisplayFromFTP( _
   ByVal Uri As String, _
   ByVal Login As String, _
   ByVal Password As String _
) As GdPictureStatus
public GdPictureStatus DisplayFromFTP( 
   string Uri,
   string Login,
   string Password
)
public function DisplayFromFTP( 
    Uri: String;
    Login: String;
    Password: String
): GdPictureStatus; 
public function DisplayFromFTP( 
   Uri : String,
   Login : String,
   Password : String
) : GdPictureStatus;
public: GdPictureStatus DisplayFromFTP( 
   string* Uri,
   string* Login,
   string* Password
) 
public:
GdPictureStatus DisplayFromFTP( 
   String^ Uri,
   String^ Login,
   String^ Password
) 

Parameters

Uri
The full URI path with the full document name, where the file is located, for example ftp://ftp.mywebsite.com/mydocument.pdf.
Login
The user's login required to authenticate on the server.
Password
The user's password required to authenticate on the server.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.

Use the GetLastTransferError method to diagnose the error if this method has failed with one of the GdPictureStatus.Internet... errors.

Remarks
Just to remind you that both the DataReceived event and the TransferEnded event are raised to allow you to monitor the transfer progress.

Likewise, you can also utilize both the BeforeDocumentChange and the AfterDocumentChange events using this method.

Example
How to display your image from a distant server using the FTP transfer.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFTP("ftp://ftp.mywebsite.com/mydocument.pdf", "login", "password") = GdPictureStatus.OK Then
    'Do your stuff here.
Else
    If GdViewer1.GetStat() = GdPictureStatus.InternetConnectError Then
        'Use the GetLastTransferError() method here to find the reason for the failure.
        MessageBox.Show("Internet connection error: " + GdViewer1.GetLastTransferError(), "GdViewer.DisplayFromFTP")
    Else
        MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromFTP")
    End If
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFTP("ftp://ftp.mywebsite.com/mydocument.pdf", "login", "password") == GdPictureStatus.OK)
{
    //Do your stuff here.
}
else
{
    if (GdViewer1.GetStat() == GdPictureStatus.InternetConnectError)
        //Use the GetLastTransferError() method here to find the reason for the failure.
        MessageBox.Show("Internet connection error: " + GdViewer1.GetLastTransferError(), "GdViewer.DisplayFromFTP");
    else
        MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.DisplayFromFTP");
}
See Also