2010-11-24 84 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,""); 
相关问题