473,811 Members | 3,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add to elements of a string array

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

Oct 19 '06 #1
4 5529

Colin Williams wrote:
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.

Oct 19 '06 #2
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.Selec tedItems.Count;
string spath = flbsource.Path + "\\";

String[] source = new String[iCount];

flbsource.Selec tedItems.CopyTo (source, 0);

Thanks
Colin

Oct 19 '06 #3

Colin Williams wrote:
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.Selec tedItems.Count;
string spath = flbsource.Path + "\\";

String[] source = new String[iCount];

flbsource.Selec tedItems.CopyTo (source, 0);
How about something like:

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

?

Oct 19 '06 #4
Thanks

Oct 20 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2432
by: Randell D. | last post by:
Folks, I know I could do this with a foreach loop but it looks dirty. I'm wondering if I can do this via array_walk() or asort() and would appreciate some help.. I have an array - an example follows $tmpArray="one"; $tmpArray="two";
34
4184
by: Adam Hartshorne | last post by:
Hi All, I have the following problem, and I would be extremely grateful if somebody would be kind enough to suggest an efficient solution to it. I create an instance of a Class A, and "push_back" a copy of this into a vector V. This is repeated many times in an iterative process. Ok whenever I "push_back" a copy of Class A, I also want to assign a pointer contained in an exisiting instance of a Class B to this
18
8013
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm = document.forms; // more code here........ }
5
6540
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with the object references. However, I just realized that indices may only be referenced by strings.
8
1985
by: JS | last post by:
I am trying to add an element to an array like this: var ty = ; zz = "ty"; var ab = null; zz+=""; ab = eval(zz); document.write(ab.length);
8
5235
by: ljlevend2 | last post by:
If a property's type is an array and the property is exposed in a PropertyGrid, then the property can be expanded so that the user can view and edit the array elements. But, I've noticed that if the property is ReadOnly then the expanded array elements can still be edited. I need to make the elements ReadOnly if the property is ReadOnly. Is this possible? Thank you, Lance
24
4410
by: RyanTaylor | last post by:
I have a final coming up later this week in my beginning Java class and my prof has decided to give us possible Javascript code we may have to write. Problem is, we didn't really cover JS and what we covered was within the last week of the class and all self taught. Our prof gave us an example of a Java method used to remove elements from an array: public void searchProcess() { int outIt=0;
6
18958
by: pinetaj | last post by:
Hello, I have a question of using 'property' on accessing elements of array. There is an array member in a class. I'd like to restrict accessing the elements of the array through property. And also by annotating the set method of the property with user-defined attribute, i'd like to activate something whenever the set method is invoked. I wrote the code as the followings. But, my problem is that it allows to set a value on an element of...
5
2883
by: Paul Brettschneider | last post by:
Hello, I have a global static array of structs and want to access a given element using an identifier. I don't want to use the element subscript, because it will change if I insert elements before the element I want to access. In assembler I would simply add a label in front of the element, but this doesn't work in C++. The following programm snippet might explain what I want to do:
3
2687
by: SM | last post by:
Hello, I have an array that holds images path of cd covers. The array looks like this: $cd = array( 589=>'sylver.jpg', 782=>'bigone.jpg', 158=>'dime.jpg' );
0
9724
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10394
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10127
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5552
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.