Add to elements of a string array

  • Thread starter Thread starter Colin Williams
  • Start date Start date
C

Colin Williams

Hi
I have a file list box with which i am passing the selected items to a
string array (using copyTo), however i also need to pass the path of
the FLB with each string in the array. Is it possible to add this to
each element of the array or is there another approach i could take.

Thanks

Colin Williams
 
Colin said:
Hi
I have a file list box with which i am passing the selected items to a
string array (using copyTo), however i also need to pass the path of
the FLB with each string in the array. Is it possible to add this to
each element of the array or is there another approach i could take.

I would create a new string array of the same size and build each file
name into a full path and put it in the new string array, effectively
transforming the array you have of file names into another array of
file paths.
 
Thanks for the reply.

Could you give me some advice on how to do that.

Here is the code so far.

int iCount = 0;

iCount = flbsource.SelectedItems.Count;
string spath = flbsource.Path + "\\";

String[] source = new String[iCount];

flbsource.SelectedItems.CopyTo(source, 0);

Thanks
Colin
 
Colin said:
Thanks for the reply.

Could you give me some advice on how to do that.

Here is the code so far.

int iCount = 0;

iCount = flbsource.SelectedItems.Count;
string spath = flbsource.Path + "\\";

String[] source = new String[iCount];

flbsource.SelectedItems.CopyTo(source, 0);

How about something like:

string spath = flbsource.Path + @"\";
string[] selectedPaths = new string[flbsource.SelectedItems.Count];
for (int i = 0; i < flbsource.SelectedItems.Count; i++)
{
selectedPaths = spath + flbsource.SelectedItems;
}

?
 
Back
Top