2010-11-24 83 views
0

我填充這樣的組合框。希望是空的。我該怎麼做?Combobox的第一個值應該是null

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

我爲什麼會問? – Vishal 2010-11-24 18:01:33

回答

1

嘗試添加LoadName.Add(null);在循環之前。

+0

thaanks它的工作正常(擁抱) – 2010-11-24 18:21:56

1

剛剛過去的行之前添加此行:

LoadName.InsertAt(0,""); 
相關問題