Support Forums

Full Version: [NEED HELP] Can´t send strings + list of strings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I´m working on a remote file browser atm and I found a function on the internetz which gives me all files and folders of a drive in a string list. Now I need to send a command to the client which tells the client this list and what to do with it. Looks like this now:

Code:
SendData("Add|" & GetFileList(SplitData(1)))

But I get an error that the &-operator is not defined for string and System.Collections.Generic.List(Of String). What can I do?
Any help is appreciated =)
I don't understand exactly what you are trying to do, but I understand the error. The function GetFileList doesn't return a string but a list of strings meaning a collection of strings. So, you can't concatenate a string with a list. However, if you wanted to do the SendData for each item in the GetFileList here is the correct code:
Code:
For Each str as String in GetFileList(SplitData(1)) 'we loop through all items in the list returned by GetFileList
  SendData("Add|" & str) 'we call SendData individually for each item
Next
I hope this helps.
(08-02-2010, 11:17 PM)thanasis2028 Wrote: [ -> ]I don't understand exactly what you are trying to do, but I understand the error. The function GetFileList doesn't return a string but a list of strings meaning a collection of strings. So, you can't concatenate a string with a list. However, if you wanted to do the SendData for each item in the GetFileList here is the correct code:
Code:
For Each str as String in GetFileList(SplitData(1)) 'we loop through all items in the list returned by GetFileList
  SendData("Add|" & str) 'we call SendData individually for each item
Next
I hope this helps.

That Won't Work In His Case.

I Will post a solution later.