title: BEST way prompt user 4 .txt, read it, separate by ",", iterate 2 find 1st str with "A" , "a", same 4 "Z" , "z" in C#?
body: <p>I have been at this problem all day long and seem like I am getting no-where fast. I am very very new at programming but do a good job understanding and explaining (I think so anyway). I have been at this computer for 12 hours trying to figure this out and I'm tired and brain needs a rest. Any help would be greatly appreciated. The part I cannot get past is figuring out how to make a decision based on the first char of each string. I have tried IndexOf with char, char[], strings, string[], mix mashin them and more than once, I have tried everything EXCEPT the RIGHT way. I tried StartsWith, Substring both attempting most likely every thing but how it is suppose to be done. Please help</p>
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
      private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
      {
          string files = openFileDialog1.FileName;
      }
  
      public void button1_Click(object sender, EventArgs e)
      { 
          if (openFileDialog1.ShowDialog() == DialogResult.OK)
          {
              try
              {
                  //Create string of all text in file
                  string someText = File.ReadAllText(openFileDialog1.FileName);
                  //Turn someText into a char arra
                  char[] array = someText.ToCharArray();
                  //Define vowels in a char array
                  char[] vowels = { 'a', 'A', 'e', 'E', 'i', 'I', 'o', 'O', 'u', 'U' };
                  //Converts someText to lowercase
                  string lower = someText.ToLower();
                  //Shows the lowercase text
                  char[] charSeparators = new char[] { ',' };
                  string[] split = 
                  someText.Split(charSeparators,StringSplitOptions.RemoveEmptyEntries);
                  string result = split.ToString(); 
                  int watch = result[0];
                  int at = 0;
                  int end = lower.Length;
                  int start = 0;
                  int count;
                  while ((start &lt;= end) &amp;&amp; (at &gt;= -1))
                  {
                      // start+count must be a position within -str-.
                      count = start;
                      at = lower.IndexOf(&quot;a&quot;, start, count);
                      start = 0;
                      MessageBox.Show(&quot;{0} &quot;, at.ToString());
                                      
                      break;
                  }   
              }
              catch (Exception ex)
              {
                  MessageBox.Show($&quot;Security error.\n\nError message: {ex.Message}\n\n&quot; +
                  $&quot;Details:\n\n{ex.StackTrace}&quot;);
              }
          }
      }
      
      private void button2_Click(object sender, EventArgs e)
      {
          this.Close();
      }
  }
  </code></pre>