Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4102902
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:53:20+00:00 2026-05-20T20:53:20+00:00

I’m writing a wrapper class to expose a subset of the functionality of a

  • 0

I’m writing a wrapper class to expose a subset of the functionality of a .NET FTP library edtftpne from Enterprise Distributed Technologies.

When you call the edtftp’s GetFileInfos method you get an array of FTPFile objects returned. I’m able to iterate through these but I don’t know how to pass them on as a new and different object array containing only Name and Size for each file. Here’s the code I have. Sorry it’s a little confusing because I have my own class named FTPFile and the .NET library I’m using also has a class named FTPFile. I’m using both of them here. I should probably change the name of my class just to avoid confusion:

Public Function GetFileList() As FTPFile() Implements IFTP.GetFileList
    Dim ftpfiles() As EnterpriseDT.Net.Ftp.FTPFile
    ftpfiles = fCon.GetFileInfos 'Fill object array
    Dim f As EnterpriseDT.Net.Ftp.FTPFile
    Dim t As FTPFile = New FTPFile 'My custom class to hold FileName and FileSize for Each file
    For Each f In ftpfiles
        'What do I do here to put these in my GetFileList array?
    Next
End Function

I’m also baffled on how to write my own FTPFile class so that this function can assign properties to each object it creates but the external COM code will see the properties of
my FTPFile class as ReadOnly.

Here’s what my FTPFile class looks like:

Public Interface IFTPFile
    ReadOnly Property FileSize() As Long
    ReadOnly Property FileName() As String
End Interface

<ClassInterface(ClassInterfaceType.None)> _
Public Class FTPFile : Implements IFTPFile
    Private sFileName As String = ""
    Private lFileSize As Long

    Public ReadOnly Property FileName() As String Implements IFTPFile.FileName
        Get
            FileName = sFileName
        End Get
        'Set(ByVal value As String)
        '    sFileName = value
        'End Set
    End Property

    Public ReadOnly Property FileSize() As Long Implements IFTPFile.FileSize
        Get
            FileSize = lFileSize
        End Get
        'Set(ByVal value As Long)
        '    lFileSize = value
        'End Set
    End Property
End Class

Maybe I’m going about this totally wrong. I’d just pass on the object array that I’m getting from the GetFileInfos method but COM clients won’t have access to the class/object EnterpriseDT.Net.Ftp.FTPFile without me rewriting it, I’m assuming.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:53:21+00:00Added an answer on May 20, 2026 at 8:53 pm

    You have to create the array that you want to return, then you create objects for the array inside the loop:

    Public Function GetFileList() As FTPFile() Implements IFTP.GetFileList
      Dim ftpfiles() As EnterpriseDT.Net.Ftp.FTPFile
      ftpfiles = fCon.GetFileInfos
      Dim result(ftpfiles.Length - 1) As FtpFile
      For i As Integer = 0 to ftpfiles.Length - 1
        result(i) = New FTPFile(ftpfiles(i).FileName, ftpfiles(i).FileSize)
      Next
      Return result
    End Function
    

    Add a constructor to the FTPFile class so that you can set the properties when you create each instance:

    Public Sub New(name As String, size as Long)
      sFileName = name
      lFileSize = size
    End Sub
    

    Note: It’s not recommended to use hungarian notation to specify data type in variable names. VB is a typed language, so it’s not so important to keep track of the data types that you have to clutter up the variable names with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am currently running into a problem where an element is coming back from
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am writing an app with both english and french support. The app requests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.