poringgunner
Active member
- Joined
- Feb 23, 2014
- Messages
- 42
- Programming Experience
- Beginner
for (int b = 0; b < fileCount.browseCount; b++ ) { var rtb = tabControl1.TabPages[b].Controls.OfType<RichTextBox>().Single(); for (int d = 0; d < fileCount.browseCount; d++) { if (b != d) { var rtb2 = tabControl1.TabPages[d].Controls.OfType<RichTextBox>().Single(); int blc = 0; string[] richarraycom = rtb.Text.Split(' ', '\n'); string[] richarraycom2 = rtb2.Text.Split(' ', '\n'); for (int a = 0; a < rtb.Lines.Count(); a++) { if (rtb.Lines.Count(string.IsNullOrEmpty) > rtb2.Lines.Count(string.IsNullOrEmpty)) { blc = rtb.Lines.Count(string.IsNullOrEmpty) - rtb2.Lines.Count(string.IsNullOrEmpty); } if (rtb.Lines.Count(string.IsNullOrEmpty) <= rtb2.Lines.Count(string.IsNullOrEmpty)) { blc = rtb2.Lines.Count(string.IsNullOrEmpty) - rtb.Lines.Count(string.IsNullOrEmpty); } int bl = 0; int bld = 0; foreach (string c in rtb.Lines[a].Split(' ', '\n')) { foreach (string v in rtb2.Lines[a].Split(' ', '\n')) { if (rtb.Text.Contains(Environment.NewLine) && rtb2.Text.Contains(Environment.NewLine)) { for (int add = 0; add < rtb2.Lines.Count(string.IsNullOrEmpty); add++) { if (string.IsNullOrWhiteSpace(c) && string.IsNullOrWhiteSpace(v)) { bl++; } } } if (c == v) { n++; } bld = bl - blc; n = n - bld; if (rtb.Text.Count() > rtb2.Text.Count()) { m = richarraycom.Length - sub; } if (rtb.Text.Count() <= rtb2.Text.Count()) { m = richarraycom2.Length - sub; } } } } } if(b == d || d == b) { d++; MessageBox.Show(b.ToString() + " " + d.ToString()); } if (n > m && n != 0) { o = m / n * 100; } if (n <= m && m != 0) { o = n / m * 100; } n = 0; m = 0; label1.Text = o.ToString("#.##"); } }
i dont know why the b and d variables always increment at the same time in every loop. all i want is, if the d variable is equal to the. the b variables will increment by 1. then if the b variables is equal to 10.. the loop will stop.
Last edited by a moderator: