title: Change variables when radio button is checked
body: <p>Is there a way to condense my code? I have 5 Radio Buttons and below is my code. Currently, the code changes the values of my minimum and maximum public variables depending on which radio box is checked. This was the first way i found to change the radio buttons in real time so that the rest of my code will have the correct values for my variables minimum and maximum.</p>
  
  <pre><code>Private Sub ArtyCalculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      rBtnMortar.Checked = True
  End Sub
  Private Sub rBtnMortar_CheckedChanged(sender As Object, e As EventArgs) Handles rBtnMortar.CheckedChanged
      If rBtnMortar.Checked Then
          Min = 45
          Max = 65
          NameofArty = "Mortar"
          txtMinimum.Text = "Minimum Distance: " &amp; Min
          txtMaximum.Text = "Maximum Distance: " &amp; Max
          txtMinimum.Refresh()
          txtMaximum.Refresh()
      End If
  End Sub
  
  Private Sub rBtnHowitzer_CheckedChanged(sender As Object, e As EventArgs) Handles rBtnHowitzer.CheckedChanged
      If rBtnHowitzer.Checked Then
          Min = 75
          Max = 150
          NameofArty = "Howitzer"
          txtMinimum.Text = "Minimum Distance: " &amp; Min
          txtMaximum.Text = "Maximum Distance: " &amp; Max
          txtMinimum.Refresh()
          txtMaximum.Refresh()
      End If
  End Sub
  
  Private Sub rBtnFieldArtillery_CheckedChanged(sender As Object, e As EventArgs) Handles rBtnFieldArtillery.CheckedChanged
      If rBtnFieldArtillery.Checked Then
          Min = 75
          Max = 150
          NameofArty = "Field Artillery"
          txtMinimum.Text = "Minimum Distance: " &amp; Min
          txtMaximum.Text = "Maximum Distance: " &amp; Max
          txtMinimum.Refresh()
          txtMaximum.Refresh()
      End If
  End Sub
  
  Private Sub rBtnGunBoat_CheckedChanged(sender As Object, e As EventArgs) Handles rBtnGunBoat.CheckedChanged
      If rBtnGunBoat.Checked Then
          Min = 50
          Max = 100
          NameofArty = "Gun Boat"
          txtMinimum.Text = "Minimum Distance: " &amp; Min
          txtMaximum.Text = "Maximum Distance: " &amp; Max
          txtMinimum.Refresh()
          txtMaximum.Refresh()
      End If
  End Sub
  
  Private Sub rBtnTank_CheckedChanged(sender As Object, e As EventArgs) Handles rBtnTank.CheckedChanged
      If rBtnTank.Checked Then
          Min = 1
          Max = 40
          NameofArty = "Tank"
          txtMinimum.Text = "Minimum Distance: " &amp; Min
          txtMaximum.Text = "Maximum Distance: " &amp; Max
          txtMinimum.Refresh()
          txtMaximum.Refresh()
      End If
  End Sub
  </code></pre>