C# Combobox的第一个值应为null
我是这样填组合框的。“想要启动”为空。我该怎么做C# Combobox的第一个值应为null,c#,winforms,combobox,C#,Winforms,Combobox,我是这样填组合框的。“想要启动”为空。我该怎么做 private void txtLoadname_DropDown(object sender, EventArgs e) { HashSet<string> LoadName = new HashSet<string>(); for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) {
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();
}
private void txtLoadname\下拉列表(对象发送方,事件参数e)
{
HashSet LoadName=新的HashSet();
对于(int i=0;i
尝试添加LoadName.Add(空);在循环之前。在最后一行之前添加此行:
LoadName.InsertAt(0,"");