RadioButton.PerformClick 方法

定义

为控件生成一个 Click 事件,模拟用户的单击操作。

public:
 void PerformClick();
public void PerformClick ();
member this.PerformClick : unit -> unit
Public Sub PerformClick ()

示例

下面的代码示例计算 ListBox 所选内容和 CheckedRadioButton属性。 从列表框中选择指定项时, PerformClick 将调用另一个 RadioButton 的 方法。 此示例要求在窗体上实例化两 RadioButtonListBox 控件 和 。

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

适用于

另请参阅