title: how to make textbox numbers and operators only and in a valid form . . .
body: <p>when I am entering input like this "12312.-.-.,," program is not working or giving any error</p>
  
  <pre><code>            string c = textBox1.Text;
              if (c.Contains(".") || c.Contains("-") || c.Contains("1") || c.Contains("2") || c.Contains("3") || c.Contains("4") || c.Contains("5") || c.Contains("6") || c.Contains("7") || c.Contains("8") || c.Contains("9") || c.Contains("0"))
              {
                  if (c.IndexOf('-') == 0 || c.IndexOf('.')==c.Length-1)
                  {
                      c = c.Substring(1, c.Length - 1);
                      if (c.Contains("-") || c.Contains("."))
                      {
                          MessageBox.Show("Error");
                      }
  
  
                  }
              }
              else { textBox1.Clear(); }```
  </code></pre>