RadioButton.Checked 屬性

定義

取得或設定值,指出是否選取控制項。Gets or sets a value indicating whether the control is checked.

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

屬性值

Boolean

如果核取方塊被選取,則為 true,否則為 falsetrue if the check box is checked; otherwise, false.

屬性

範例

下列程式碼範例會評估 ListBox 選取範圍和的 Checked 屬性 RadioButtonThe following code example evaluates a ListBox selection and the Checked property of a RadioButton. 從清單方塊中選取指定的專案時, PerformClick 會呼叫另一個專案的方法 RadioButtonWhen a specified item is selected from the list box, the PerformClick method of another RadioButton is called. 此範例需要 RadioButton ListBox 在表單上具現化兩個控制項和。This example requires that two RadioButton controls and a ListBox have been instantiated on a form.

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

適用於