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

Windows Forms birleşik giriş Windows, liste kutusu veya işaretli liste kutusunda belirli öğelere erişmek temel bir görevdir. Belirli bir konumdaki listede ne olduğunu program aracılığıyla belirlemenize olanak sağlar.

Belirli bir öğeye erişmek için

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

    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.