Share via


LabelEditEventArgs.Label Özellik

Tanım

etiketine ListViewItematanan yeni metni alır.

public:
 property System::String ^ Label { System::String ^ get(); };
public string Label { get; }
public string? Label { get; }
member this.Label : string
Public ReadOnly Property Label As String

Özellik Değeri

veya metni değiştirilmemişse ile ListViewItemnull ilişkilendirilecek yeni metin.

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir. Örnekte, olay işleyicisi olayın oluşumunu ListView.AfterLabelEdit raporlar. Bu rapor, olayın ne zaman gerçekleştiğini öğrenmenize yardımcı olur ve hata ayıklamada size yardımcı olabilir. Birden çok olayı veya sık gerçekleşen olayları raporlamak için, iletisini ile Console.WriteLine değiştirmeyi MessageBox.Show veya iletiyi çok satırlı TextBoxbir iletiye eklemeyi göz önünde bulundurun.

Örnek kodu çalıştırmak için, adlı ListView1bir tür ListView örneği içeren bir projeye yapıştırın. Ardından olay işleyicisinin olayla ilişkilendirildiğinden ListView.AfterLabelEdit emin olun.

private void ListView1_AfterLabelEdit(Object sender, LabelEditEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Label", e.Label );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Item", e.Item );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CancelEdit", e.CancelEdit );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "AfterLabelEdit Event" );
}
Private Sub ListView1_AfterLabelEdit(sender as Object, e as LabelEditEventArgs) _ 
     Handles ListView1.AfterLabelEdit

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Label", e.Label)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Item", e.Item)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "CancelEdit", e.CancelEdit)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"AfterLabelEdit Event")

End Sub

Şunlara uygulanır