Share via


RadioButton.Checked Propriedade

Definição

Obtém ou define um valor que indica se o controle está selecionado.

public:
 property bool Checked { bool get(); void set(bool value); };
public bool Checked { get; set; }
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.SettingsBindable(true)]
public bool Checked { get; set; }
member this.Checked : bool with get, set
[<System.ComponentModel.Bindable(true)>]
[<System.ComponentModel.SettingsBindable(true)>]
member this.Checked : bool with get, set
Public Property Checked As Boolean

Valor da propriedade

Boolean

true se a caixa de seleção estiver selecionada; caso contrário, false.

Atributos

Exemplos

O exemplo de código a seguir avalia uma ListBox seleção e a Checked propriedade de um RadioButton. Quando um item especificado é selecionado na caixa de listagem, o PerformClick método de outro RadioButton é chamado. Este exemplo exige que dois RadioButton controles e um ListBox tenham sido instanciados em um formulário.

private:
   void ClickMyRadioButton()
   {
      // If Item1 is selected and radioButton2 
      // is checked, click radioButton1.
      if ( listBox1->Text == "Item1" && radioButton2->Checked )
      {
         radioButton1->PerformClick();
      }
   }
private void ClickMyRadioButton()
{
   // If Item1 is selected and radioButton2 
   // is checked, click radioButton1.
   if (listBox1.Text == "Item1" && radioButton2.Checked)
   {
      radioButton1.PerformClick();
   }
}
Private Sub ClickMyRadioButton()
    ' If Item1 is selected and radioButton2 
    ' is checked, click radioButton1.
    If (listBox1.Text = "Item1") And radioButton2.Checked Then
        radioButton1.PerformClick()
    End If
End Sub

Aplica-se a