Bagikan melalui


RadioButton.Checked Properti

Definisi

Mendapatkan atau menetapkan nilai yang menunjukkan apakah kontrol dicentang.

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

Nilai Properti

true jika kotak centang dicentang; jika tidak, false.

Atribut

Contoh

Contoh kode berikut mengevaluasi ListBox pilihan dan Checked properti .RadioButton Ketika item tertentu dipilih dari kotak daftar, PerformClick metode lain RadioButton dipanggil. Contoh ini mengharuskan dua RadioButton kontrol dan telah ListBox diinstansiasi pada formulir.

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

Berlaku untuk