title: How do I enable a Calculate button in visual basic when i need 2 radio buttons selected and text in a text box
body: <p>Alright so I'm writing a program that converts Celsius Kelvin and Fahrenheit. By default I have my calculate button disabled until the user puts in a temperature and selects the radio button for the corresponding temperature and what temperature is being converted to.  I am having a great deal of issues trying to enable the calculate button.  I'm not sure what to do since nested if statements in the calculate area are not working.  Here is what I have so far:</p>
  
  <pre><code>Option Strict On
  Option Explicit On
  
  Public Class FmMain
      'Yes I understand that this program is very easy to break
  
      Private Sub BtnCalc_Click(sender As Object, e As EventArgs) Handles BtnCalc.Click
  
          Try
  
              Dim num1 As Decimal
              Dim num2 As Decimal
              Dim Answer As Decimal
              Dim Flag As Integer
              Dim Flag2 As Integer
              Dim T1 As String
  
              'This is where I'm trying to enable the calculate button
              If TxtNum1.Text &lt;&gt; "" Then
                  If RadC1.Checked Or RadF1.Checked Or RadK1.Checked Then
                      If RadC2.Checked Or RadF2.Checked Or RadK2.Checked Then
                          BtnCalc.Enabled = True
                          BtnCalc.Focus()
                      End If
                  End If
              End If
  
  
              'This block of code makes sure that the input that is entered is numerical and does not break the program.
              If TxtNum1.Text &lt;&gt; "" Then 'I won't need this line once I can get the calculate button enabled and disabled at will
                  If IsNumeric(TxtNum1.Text) Then
  
                      If RadF1.Checked And RadC2.Checked Then
                          Flag = 1
                      ElseIf RadF1.Checked And RadK2.Checked Then
                          Flag = 2
                      ElseIf RadC1.Checked And RadF2.Checked Then
                          Flag = 3
                      ElseIf RadC1.Checked And RadK2.Checked Then
                          Flag = 4
                      ElseIf RadK1.Checked And RadF2.Checked Then
                          Flag = 5
                      Else
                          Flag = 6
                      End If
  
                      If RadF2.Checked Then
                          Flag2 = 1
                      ElseIf RadC2.Checked Then
                          Flag2 = 2
                      Else
                          Flag2 = 3
                      End If
  
                      Answer = ModCalc.Temperature(num1, Flag, num2)
                      T1 = ModCalc.Temp(Flag2)
                      MessageBox.Show("The Answer is: " &amp; Answer.ToString &amp; " " &amp; T1 &amp; ".", "This is a Message Box", MessageBoxButtons.OK, MessageBoxIcon.Information)
  
                  Else
                      MessageBox.Show("Please enter a number", "Bad Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                  End If
  
              Else
                  MessageBox.Show("Please enter a number", "Bad Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
              End If
  
  
          Catch ex As Exception
  
          End Try
  
      End Sub
      'This just ensures that the user can't click the same radio button on both sides
      Private Sub RadF1_CheckedChanged(sender As Object, e As EventArgs) Handles RadF1.CheckedChanged
          If RadF1.Checked Then
              RadF2.Checked = False
              RadF2.Enabled = False
              RadC2.Enabled = True
              RadK2.Enabled = True
          End If
      End Sub
  
      Private Sub RadC1_CheckedChanged(sender As Object, e As EventArgs) Handles RadC1.CheckedChanged
          If RadC1.Checked Then
              RadC2.Checked = False
              RadC2.Enabled = False
              RadF2.Enabled = True
              RadK2.Enabled = True
          End If
      End Sub
  
      Private Sub RadK1_CheckedChanged(sender As Object, e As EventArgs) Handles RadK1.CheckedChanged
          If RadK1.Checked Then
              RadK2.Checked = False
              RadK2.Enabled = False
              RadF2.Enabled = True
              RadC2.Enabled = True
          End If
      End Sub
  
  End Class
  </code></pre>