I am trying to help a friend of mine with a c# assignment and I can't figure out why when I read in a series of 3 character strings and compare them to predetermined values, that it keeps coming up 0. I haven't done c# in a while and my mind is boggled.
It just refuses to ever count anything for countS and countStop.Code:private void btnRead_and_Count_Starts_Click(object sender, EventArgs e) { StreamReader reader = new StreamReader(openFile.FileName); int countS = 0; int countStop = 0; int count = 0; string s = ""; string print = ""; string print2 = ""; do { s = reader.ReadLine(); switch (s) { case "aug": MessageBox.Show("hi"); countS++; break; case "gug": countS++; break; case "uug": countS++; break; case "uag": countStop++; break; case "uga": countStop++; break; case "uaa": countStop++; break; default: count++; break; } } while (!reader.EndOfStream); reader.Close(); print = "Start Codons: " + countS; print2 = "Stop Codons: " + countStop; lstDNA.Items.Add(print); lstDNA.Items.Add(print2); } }