RobotStudio event

Displaying controller Folder and Files in ListView

Hello I am looking for a way to display the controller folder and files in a ListView in my application.  I was looking through the Controller.FileSystem methods and came
across BeginListDirectory but not sure if that is the correct one to use.  Anybody got any suggestions?
Tagged:

Comments

  • How can I get more help on BeginListDirectory and examples of using this?
  • Newbe,
    I was also looking for the same thing and I have figured it out with help from Rob Thornton at ABB US.  Thanks Rob.  Below is the code that I figured out from the function that you recommended.

      Public Sub LoadControllerListView(ByRef lvToLoad As ListView, ByVal sFolderToLoad As String)

        Dim sFileType As String = ""
        Dim aFileSystem As Controllers.FileSystemDomain.FileSystem = controller.FileSystem
        Dim anArray As Controllers.FileSystemDomain.ControllerFileSystemInfo()
        Dim info As Controllers.FileSystemDomain.ControllerFileSystemInfo
        Try
          controller.FileSystem.RemoteDirectory() = sFolderToLoad
          anArray = controller.FileSystem.GetFilesAndDirectories(".")
          lvToLoad.Items.Clear()
          For i As Integer = 0 To anArray.Length - 1
            info = anArray(i)
            If info.Name <> ".." And info.Name <> "." Then
              Dim item As New ListViewItem(info.Name)
              lvToLoad.Items.Add(item)
            End If
          Next
        Catch ex As Exception

        End Try

      End Sub



  • Hey David,
    Thanks for the example code, it works great!  I have already updated my app.

    BR,
    Newbe