title: Change RadioButton checkstate in event
body: <p>I'm migrating some legacy code from VB6 to VB.NET and I've run into an annoying issue. What's currently happening is the user is provided with <code>RadionButton</code> controls to denote hierarchy. When they select a value the code verifies that it's valid (can't have C be the child of A, has to be the child of B) and if it's not it returns the <code>RadioButton</code> to the original setting.</p>
  
  <p>The issue is that when the function that does this returns to the event handler it returns the <code>RadioButton</code> state to how it was when it was clicked (User clicked C, code returns it to B, when function exits it returns to C firing the event that'll turn it to B again, etc., etc. causing an infinite loop). Is there a way to change which <code>RadioButton is selected inside a function called by</code>CheckedChanged` event and have it stick?</p>
  
  <p>I know the better design is to disable the invalid <code>RadioButton</code> controls ahead of time, but this is how it's designed and my job is to get it working in a limited time frame, so I'm stuck with bad design now as opposed to good design later.</p>
  
  <p>Code:</p>
  
  <pre><code>Private Sub optIndent_2_ClickEvent(sender As Object, e As EventArgs) Handles optIndent_2.CheckedChanged
      optIndent_Click(2, sender.Checked)
  End Sub
  
  Private Sub optIndent_3_ClickEvent(sender As Object, e As EventArgs) Handles optIndent_3.CheckedChanged
      optIndent_Click(3, sender.Checked)
      Dim i As Integer = 1
  End Sub
  
  Private Sub optIndent_Click(ByRef Index As Short, ByRef value As Short)
      If value = False Then
          Exit Sub
      End If
  
      If Index = 2 Then
          Exit Sub
      End If
      If Index = 3 Then
          optIndent_2.Checked = True
          Exit Sub
      End If
  End Sub
  </code></pre>
  
  <p>You'll see that when the code exits <code>optIndent_Click (3, sender.checked)</code> the value will transition from false to true, the process will repeat forever.</p>