ComboBox Items Empty but DataSource Full

前端 未结 3 1361
梦谈多话
梦谈多话 2021-02-19 07:14

After binding a list to combobox, its dataSource.Count is 5 but, combobox item count is 0. how can it be?

I\'m used to Web programming and this is in Windows Forms. So

3条回答
  •  你的背包
    2021-02-19 07:57

    I had the same problem, but in my case it was caused by calling

    combobox.Sorted = True
    

    in InitializeComponent. I guess that call initializes Items, which then prevents the assignment to DataSource from updating it (Items).

提交回复
热议问题