Aracılığıyla paylaş


Nasıl yapılır: Bir Windows Forms ComboBox, ListBox veya CheckedListBox Denetiminde Belirli Öğelere Erişme

Windows Forms birleşik giriş kutusundaki, liste kutusundaki veya işaretli liste kutusundaki belirli öğelere erişmek önemli bir görevdir. Belirli bir konumda bir listede ne olduğunu program aracılığıyla belirlemenizi sağlar.

Belirli bir öğeye erişmek için

  1. Items Belirli bir öğenin dizinini kullanarak koleksiyonu sorgula:

    Private Function GetItemText(i As Integer) As String  
       ' Return the text of the item using the index:  
       Return ComboBox1.Items(i).ToString  
    End Function  
    
    private string GetItemText(int i)  
    {  
       // Return the text of the item using the index:  
       return (comboBox1.Items[i].ToString());  
    }  
    
    private:  
       String^ GetItemText(int i)  
       {  
          // Return the text of the item using the index:  
          return (comboBox1->Items->Item[i]->ToString());  
       }  
    

Ayrıca bkz.