leo88 0 Junior Poster

Hi, i am confused about some text box problems, as below:

double v3;
             foreach (String cvt in sortList2.Keys)
             {
                 if (!(sortList8.ContainsKey(cvt)))
                 {
                     sortList2.TryGetValue(cvt, out v3);
                     sortList8.Add(cvt, v3);                                                                                
                     sortList8[cvt] = (v3 * 100 / textBox2.Lines.Length);
                 }
             }

In codes above, v3 is double typed values like 1,2,3,4..(not 1.1, 2.3..). My problem is,
after the calculation, my output become 36.37, 18.18..(something like that). After i change the "textBox2.Lines.Length" to 10, it just can show output like 40,20.. which are my desired outputs. What happen to the "textBox2.Lines.Length" ? (the actual number of line in the textbox is 10 lines of items, but it show 11 in messagebox,why?)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.