title: How do I make a text box accept only int between 1 to 6
body: <p>I've been trying to figure out how to do this for hours. How do I make the program takes only values from 1 to 6 or else it crashes?</p>
  
  <blockquote>
    <p>"user only enters acceptable credit hours-- every credit hours entered is an integer between 0 and 6 and nothing else. In this case, any invalid or bad or empty input data will cause a run-time error, which is expected and is fine."</p>
  </blockquote>
  
  <p>this is one of the methods i tried that did not work. I need to find out how to make the program just give a runtime error. I dont need to keep asking for input or display a message saying "error"</p>
  
  <pre><code>creditHours = double.Parse(tb_credit.Text);
  
  if (creditHours != 1 || creditHours != 2 || creditHours != 3 || 
      creditHours != 4 || creditHours != 5 || creditHours != 6)
  { 
      creditHours = double.Parse(tb_credit.Text); 
  }
  </code></pre>