2010-11-24 16 views
0

Je remplis la zone de liste comme ça. vouloir firts était nul. comment puis-je faire ça?Les premières valeurs de Combobox doivent être nulles

private void txtLoadname_DropDown(object sender, EventArgs e) 
    { 
     HashSet<string> LoadName = new HashSet<string>(); 
     for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) 
     { 
      LoadName.Add(dataGridView1.Rows[i].Cells["loadNameDataGridViewTextBoxColumn"].Value.ToString()); 
     } 
     txtLoadname.DataSource = LoadName.ToList(); 


    } 
+0

Pourquoi puis-je demander? – Vishal

Répondre

1

Essayez d'ajouter LoadName.Add (null); avant la boucle.

+0

tire son travail bien (câlin) –

1

ajouter cette ligne juste avant la dernière ligne:

LoadName.InsertAt(0,"");