Support Forums
[NEED HELP] Can´t send strings + list of strings - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19)
+---- Thread: [NEED HELP] Can´t send strings + list of strings (/showthread.php?tid=10330)



[NEED HELP] Can´t send strings + list of strings - Luzifer - 07-30-2010

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 =)


RE: [NEED HELP] Can´t send strings + list of strings - thanasis2028 - 08-02-2010

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.


RE: [NEED HELP] Can´t send strings + list of strings - wchar_t - 08-06-2010

(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.