次の方法で共有


RadioButton.PerformClick メソッド

コントロールの Click イベントを生成して、ユーザーによるクリックをシミュレートします。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

構文

'宣言
Public Sub PerformClick
'使用
Dim instance As RadioButton

instance.PerformClick
public void PerformClick ()
public:
void PerformClick ()
public void PerformClick ()
public function PerformClick ()

使用例

ListBox の選択項目と、RadioButtonChecked プロパティを評価するコード例を次に示します。指定された項目がリスト ボックスで選択されると、別の RadioButtonPerformClick メソッドが呼び出されます。この例は、2 つの RadioButton コントロールおよび ListBox がフォーム上でインスタンス化されていることを前提にしています。

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
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 void ClickMyRadioButton()
{
    // If Item1 is selected and radioButton2 is checked, click radioButton1.
    if ( listBox1.get_Text().equals("Item1") && radioButton2.get_Checked()) {
            radioButton1.PerformClick();
    }
} //ClickMyRadioButton

プラットフォーム

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

RadioButton クラス
RadioButton メンバ
System.Windows.Forms 名前空間
Control.Click イベント