Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rank In Array to Reference Other Array 1

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
I have two string arrays

Code:
 //Folders to look at 
                string[] fnames = new string[6];
                fnames[0] = Fwatches.Default.fpath1.ToString();
                fnames[1] = Fwatches.Default.fpath2.ToString();
                fnames[2] = Fwatches.Default.fpath3.ToString();
                fnames[3] = Fwatches.Default.fpath4.ToString();
                fnames[4] = Fwatches.Default.fpath5.ToString();
                fnames[5] = Fwatches.Default.fpath6.ToString();

                //Subject Headers to Use 
                string[] fsubject = new string[6];
                fsubject[0] = Fwatches.Default.fsubject1.ToString();
                fsubject[1] = Fwatches.Default.fsubject2.ToString();
                fsubject[2] = Fwatches.Default.fsubject3.ToString();
                fsubject[3] = Fwatches.Default.fsubject4.ToString();
                fsubject[4] = Fwatches.Default.fsubject5.ToString();
                fsubject[5] = Fwatches.Default.fsubject6.ToString();

Im moving through the first array

Code:
     foreach (string strpath in fnames)
                            {

And Im trying to build a string at the end of each iteration from the second array

Code:
   StringBuilder sb2 = new StringBuilder();
                                sb2.Append(fsubject[fnames.Rank]);

byt the rank seems to not increase in number. What am I doing wrong ?

Chance,

F, G + 2MSTG
 
rank is the depth of the array (i think)
[tt]new string[0] rank = 1
new string[0][0] rank = 2
new string[0][0][0] rank = 3[/tt]
you either want to length (number of elements) - 1 or the index of the strpath, which will require changing the foreach to for(int i = 0; i < fnames.Length; i++) {...}



Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top