CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010
    Posts
    26

    Have not been able to figure out how to format my index.

    Hi,
    I' haven't been able to figure out how to format a list of string arrays coming from the string array. Currently here is another version of my code. Each time i change my code and debugg it its seems to be given me something different. Currently my String array have 179 elements. All i want to do is display for example 6 elements at a time and create a new line like
    element 1 element 2 element 3 element 4 element 5 element 6
    new line and continue patern..


    Here is my currently code
    Code:
     while (myOut.mystring.Count()>= 180)
     {
                sw.Write("{0, -2}", myOut.mystring[count1]);
                //sw.Write("{1, -2}", myOut.mystring[count1++]);
                //sw.Write("{2, -2}", myOut.mystring[count1]);
               if (myOut.mystring.Count()== myvariable )
               {
                   sw.WriteLine();
               }
               count1++;
    
     }

  2. #2
    Join Date
    Jun 2008
    Posts
    154

    Re: Have not been able to figure out how to format my index.

    kinda looks like you are overwriting myOut.mystring.Count() while it is in the while loop, that's like saying pick a number between 1-20 but that number changes every CPU cycle.

    maybe try something like
    Code:
    int RecentCount = myOut.mystring.Count() - 180;
    
    for (int i = 0; i < RecentCount; i++)
    {
               if (RecentCount  == myvariable )
               {
                   sw.WriteLine();
               }
               count1++;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured