C#Combobox将项目移动到列表的底部

C#Combobox将项目移动到列表的底部,第1张

概述我需要在组合框项目底部添加“选择更多…”,就像在SQL 2008服务器选择器上完成一样.试试这样: List<string> srvList = new List<string>(); srvList.Add("ff"); srvList.Add("jj"); srvList.Add("pp"); srvList.Add("<Sel 我需要在组合框项目的底部添加“选择更多…”,就像在sql 2008服务器选择器上完成一样.试试这样:
List<string> srvList = new List<string>();        srvList.Add("ff");        srvList.Add("jj");        srvList.Add("pp");        srvList.Add("<Select more...>");        ComboBoxServs.Items.AddRange(srvList.ToArray<String>());

但是“选择更多…”会出现在项目的顶部.

解决方法 正如 MSDN所说:

If the Sorted property of the ComboBox is set to true,@H_419_12@the items are
inserted into the List Alphabetically. Otherwise,the items are
inserted in the order they occur within the array.

尝试将Sorted属性设置为false:

ComboBoxServs.sorted = false;    List<string> srvList = new List<string>();    srvList.Add("ff");    srvList.Add("jj");    srvList.Add("pp");    srvList.Add("<Select more...>");    ComboBoxServs.Items.AddRange(srvList.ToArray<String>());
总结

以上是内存溢出为你收集整理的C#Combobox将项目移动到列表的底部全部内容,希望文章能够帮你解决C#Combobox将项目移动到列表的底部所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1244154.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-06
下一篇 2022-06-06

发表评论

登录后才能评论

评论列表(0条)

保存