Xceed FTP Library Documentation
Example topics / VB type conversion from Long to Double
In This Topic
    VB type conversion from Long to Double
    In This Topic

    In Visual Basic, "unsigned" integer types do not exist. Variables declared as Long are signed, which means that instead of having a range of 0 to 4294967296, they have a range of –2147483648 to +2147483647. When an Xceed FTP Library v1.1 event returns a value larger than 2147483647 the number is too big to fit in a Long variable.

    When using events such as FileTransferStatus, parameters such as lTotalBytesTransferred may surpass 2147483647 when dealing with large groups of files or files larger than 2GB.

    If you want to display a positive value above VB's Long integer's maximum range, you can use a Double and do the following conversion (example shown for lBytesProcessed parameter):

    VB.NET Copy Code

    Dim dTotalBytesTransferred as Double

    dTotalBytesTransferred = lTotalBytesTransferred

    If lTotalBytesTransferred < 0 Then dTotalBytesTransferred = dTotalBytesTransferred + 4294967296

    ' Now, dTotalBytesTransferred contains a value between 0 and 4294967295!