title: Using MOD and nesting
body: <p>I'm quite new to using VB, and I'm a beginner at programming, so I apologise for the poor/untidy code :P </p>
  
  <p>I can't see what I'm doing wrong here. The program should get 3 numbers from the user, and those 3 numbers have to add up, then be divisible by 3 to be valid. Also, the number cannot be 1 less than the previous number. Failure to follow these 'rules' should result in a message box saying "INVALID SIDESWAP". I believe it is a problem with the MOD section, as no matter what I input, it always returns "VALID SIDESWAP". Any help will be greatly appreciated :)</p>
  
  <pre><code>Dim FirstNumber, SecondNumber, ThirdNumber As Integer
  
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      TextBox1.Text = FirstNumber
      TextBox2.Text = SecondNumber
      TextBox3.Text = ThirdNumber
  
      If (FirstNumber + SecondNumber + ThirdNumber) Mod 3 = 0 Then
          If (FirstNumber - SecondNumber) &lt;&gt; 1 And (SecondNumber - ThirdNumber) &lt;&gt; 1 And (ThirdNumber - FirstNumber) &lt;&gt; 1 Then
              MsgBox("VALID SIDESWAP")
          Else
              MsgBox("INVALID SIDESWAP 1")
          End If
      Else
          MsgBox("INVALID SIDESWAP 2")
      End If
  End Sub
  </code></pre>