Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[NEED HELP] Can´t send strings + list of strings
#1
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 =)
Reply
#2
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.
My software company: Porosis Software
Games: Terrantula
Apps: Mathanasis, ColorGrabber
Reply
#3
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Visual Basic] Send An Email [Tutorial] Coding Support 9 3,917 06-29-2011, 09:27 AM
Last Post: Black Ghost
  [How to] Create random strings(upper,lower and integers)[Src] Modestep 11 2,960 05-14-2011, 02:17 AM
Last Post: モrainee
  [TUT] How to make a program that send emails [VB.Net] Yoshi 42 19,681 04-14-2011, 05:34 PM
Last Post: Emily
  [Tut] Generating Random Strings (200 Random Results = LIMIT) [Tut] Resistance 7 1,861 04-12-2011, 03:18 PM
Last Post: Resistance
  [Tut] How To Save Settings and Strings in Your Form [Tut] Resistance 7 1,860 03-26-2011, 11:05 AM
Last Post: Resistance

Forum Jump:


Users browsing this thread: 1 Guest(s)