Winform - Button event

HelloAll,

Just hoping to receive some guidance with understanding Winforms and Button Events. I’m not sure if it’s the conditional statements that is preventing my expected outcome or the overall “calling” behavior of even handlers in Winforms.

Here goes.

I have a simple Winform that I ain to logme in to admin consoles internal to the network. For one instance I have a button that when clicked will execute a connection based on the current selection via a radio button.

To clarify I have a button ie GO TO and beside it are radio buttons; one for PROD and the other QA.

I have tried other conditional and regardless of the statement I am always directed to the PROD instance. It seems that the change in the radio button selection is not being recognized.

Appreciate any guidance/assistance.

The simple logic:

#Event handlers

$button_AW.Add_Click( { btnClick_AW })
$RadioButton_QA.Add_CheckedChanged( { checkChange_QA })
$RadioButton_Prod.Add_CheckedChanged( { checkChange_Prod })

#Logic

function checkChange_Prod {
    $TextBox_Output.Text = "Prod selected."
}
function checkChange_QA {
    $TextBox_Output.Text = "QA selected."
}
function btnClick_AW {
    if ($RadioButton_Prod.Checked = $true) {
        try {
            Start-Process  "https://someURL"
        }
        catch {
            $_
        }
        $TextBox_Output.Text = 'Connection to prod success'

    }
    elseif ($RadioButton_QA.Checked = $true) {
        try {
            Start-Process "https://someURL"
        }
        catch {
            $_
        }
        $TextBox_Output.Text = 'Connection to QA success'

    }
}