Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Combobox的第一个值应为null_C#_Winforms_Combobox - Fatal编程技术网

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,"");