对组合框项目进行排序 [英] sorting of combobox items

查看:102
本文介绍了对组合框项目进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你可以帮我按字母顺序排序我的组合框,因为我在C#.net和sqlserver 2005中完成了我的编码。

CAN you help me for sorting my combobox alphabeticaly by inserting items as runtime I have done my coding in C# .net and in sqlserver 2005.

推荐答案

select *从tablename命令按项目asc



使用
select * from tablename order by items asc

Use It


在填充组合框后使用以下代码



use the below code after populate your combobox

comboBox1.Items.Add("xxx");
           comboBox1.Items.Add("cxx");
           comboBox1.Items.Add("bxx");
           comboBox1.Items.Add("axx");
           comboBox1.Sorted = true;





Thanx



Thanx


示例:



Example:

 _dataContext.Users.OrderBy(u => u.Name).ToList<user>();
</user>


这篇关于对组合框项目进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆