ComboBox.SelectionChangeCommitted 이벤트

정의

사용자가 선택한 항목을 변경하고 ComboBox에 해당 변경 내용이 표시될 때 발생합니다.

public:
 event EventHandler ^ SelectionChangeCommitted;
public event EventHandler SelectionChangeCommitted;
public event EventHandler? SelectionChangeCommitted;
member this.SelectionChangeCommitted : EventHandler 
Public Custom Event SelectionChangeCommitted As EventHandler 

이벤트 유형

예제

다음 코드 예제에서는 이벤트 및 SelectionLength 속성을 사용하여 SelectionChangeCommitted 사용자가 선택하고 커밋한 내용에 따라 텍스트 상자의 길이를 변경합니다.

void comboBox1_SelectionChangeCommitted( Object^ sender, EventArgs^ /*e*/ )
{
   ComboBox^ senderComboBox = dynamic_cast<ComboBox^>(sender);
   
   // Change the length of the text box depending on what the user has 
   // selected and committed using the SelectionLength property.
   if ( senderComboBox->SelectionLength > 0 )
   {
       textbox1->Width = 
           senderComboBox->SelectedItem->ToString()->Length * 
           ((int)this->textbox1->Font->SizeInPoints);
       textbox1->Text = senderComboBox->SelectedItem->ToString();				
   }
}
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{

    ComboBox senderComboBox = (ComboBox) sender;
  
    // Change the length of the text box depending on what the user has 
    // selected and committed using the SelectionLength property.
    if (senderComboBox.SelectionLength > 0)
    {
        textbox1.Width = 
            senderComboBox.SelectedItem.ToString().Length *
            ((int) this.textbox1.Font.SizeInPoints);
        textbox1.Text = senderComboBox.SelectedItem.ToString();
    }
}
Private Sub comboBox1_SelectionChangeCommitted(ByVal sender _
As Object, ByVal e As EventArgs) _
Handles comboBox1.SelectionChangeCommitted

    Dim senderComboBox As ComboBox = CType(sender, ComboBox)

    ' Change the length of the text box depending on what the user has 
    ' selected and committed using the SelectionLength property.
    If (senderComboBox.SelectionLength > 0) Then
        textbox1.Width = _
            senderComboBox.SelectedItem.ToString().Length() * _
            CType(Me.textbox1.Font.SizeInPoints, Integer)
        textbox1.Text = senderComboBox.SelectedItem.ToString()
    End If
End Sub

설명

이벤트는 SelectionChangeCommitted 사용자가 콤보 상자 선택을 변경하는 경우에만 발생하며, 이 이벤트에 대한 처리기를 만들어 사용자가 목록에서 선택한 항목을 변경할 때 에 대한 ComboBox 특별한 처리를 제공할 수 있습니다. 그러나 가 구성된 방법과 ComboBox 사용자가 선택한 항목을 SelectionChangeCommitted 변경하는 방법에 따라 이벤트가 발생하지 않을 수 있습니다. 또는 를 처리할 SelectedIndexChanged수 있지만 이 이벤트는 인덱스가 프로그래밍 방식으로 변경되었는지 사용자에 의해 변경되었는지 여부에 관계없이 발생합니다.

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생 을 참조하십시오.

적용 대상