Saturday, August 20, 2005

How to set the Xceed LicenseKey property in a class

I have been playing with the capabilities of the Xceed FTP control. I ran into a point of confusion and I wish to share the solution. Note that there was no problem or bug with Xceed's FTP control, I just wasn't clear on how to set the needed LicenseKey property in a class rather than in a form.

All of the Xceed controls require a LicenseKey property be set with a valid license code in order to function. The example on their web site assume that you are using the component(s) on a form and show how to set the LicenseKey property just before the call to InitializeComponent(). I confirmed that this works fine on a form.

I want to write a wrapper class around the FTP control so that I can hide some of the complexity of its feature-rich interface and provide a more user-friendly interface, exposing only those capabilities that I need. Since there is no form, setting the LicenseKey needs to be slightly different and I could not find an example.

Below is what I found to work:

Public Class FTP_Example
Private FTP As Xceed.Ftp.AsyncFtpClient
Public Sub New(ByVal FTPSite As String)
Xceed.Ftp.Licenser.LicenseKey = "My License Key Goes Here"
FTP = New Xceed.Ftp.AsyncFtpClient
End Sub
End Class

I hope you find this tip useful.

Joe Kunk

Xceed is a registered trademark of Xceed Software Inc.

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.