title: How do I make an exception for a syntax error in an equation
body: <p>I'm making a simple calculator in vb.net. Users can use buttons to enter in a text box, and the equals button turns the string into an equation. It works perfectly, except for that users can just enter as much operators as they want, so they can, for example, add 7*************3. That gives a syntax error, but it shows in an external window and I want it to display "Syntax Error" in the text box, not in a different window.</p>
  
  <pre><code>Private Sub ButtonClickMethod(sender As Object, e As EventArgs) Handles equalsBtn.Click 'and other buttons, but I left them out
  
  Dim button As Button = CType(sender, Button)
  
  If button.Name = "equalsBtn" Then
              Dim equation As String = TextBox1.Text
              Dim result = New DataTable().Compute(equation, Nothing)
              TextBox1.Text = result
          End If
  
  'other buttons
  
  End Sub
  
  </code></pre>
  
  <p>want it to display "Syntax Error" in the text box, not in a different window, like it does now.</p>