Windows窗体组合框过滤数据,刷新和排序 [英] Windows Form Combo Box Filtering Data, Refresh and Sorting

查看:83
本文介绍了Windows窗体组合框过滤数据,刷新和排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在同时学习Windows应用程序和VB 2005.我已经完成了一个几乎可以完成的项目,但是在使用组合框时发现了一些问题.到目前为止,我一直在使用T-SQL在Visual Studio SSIS中为我的项目工作.

1.我有一个带有债务人名称的组合框,用户将使用该组合框来选择一条记录.我在表中有一个密钥的标识号,并在Debtor_Last_Name中进行查找.我需要按字母顺序对债务人姓氏进行排序,但是当我在属性窗口中使用排序时,它将对身份编号而不是名称进行排序.
我还注意到,当我选择一个名称时,下次访问组合框时该名称将从列表中消失.
显示成员= Debtor_Last_Name,值成员=标识号
一个.我需要按债务人姓氏排序
b.在选择其他名称之前或在添加新债务人之后,我需要刷新组合框.
我正在使用DropDownList,以便用户仅从列表中选择.
C.名称以蓝色突出显示,字体为白色,很难读取名称.
d.我想关闭名称组合框中的突出显示并将喜欢的颜色设置为黑色(就像在DropDown组合框中一样),以便于阅读名称.

2.我有另一个组合框,其中组合框中的数据取决于另一个组合框的选择.我有一个律师事务所名称字段和他们的律师字段.
律师姓名应显示在组合框中.显示成员=律师姓名和价值成员=身份证号码
一个.我只需要在律师"组合框中显示属于律师事务所组合"框中所选律师事务所的律师.我需要根据律师事务所的身份证号过滤数据.
b.律师事务所有一个身份证号码和律师事务所名称.律师有身份证号码和律师姓名.
C.律师事务所表格的关键是身份证号码
d.律师表的键是律师事务所的标识号和律师的标识号.
e.如何过滤律师以仅显示与律师事务所有关联的律师?

我可以在T-SQL中轻松地做到这一点,但是我在网上找不到任何可以教我如何做我需要做的事情的东西.我需要简单明了的说明和
代码,以便我了解该过程.我不想只复制代码,我想理解它.

我以为我应该写查询来完成如上所述的工作,但是我不知道该怎么做.
我不希望用户必须单击工具栏来运行查询.我想将代码放入自动过程中…在单击过程中.

你能帮助我吗?希望如此,因为我需要尽快完成此操作.
谢谢
Deb [已删除电子邮件]

[edit]除非您真的喜欢垃圾邮件,否则请不要在任何论坛中发布您的电子邮件地址!如果有人回复您,您将收到一封电子邮件(像这样),让您知道.[/edit]

I am learning Windows Application and VB 2005 at the same time. I’ve been given a project that I am almost done with but I found some problems with working with Combo Boxes. I have been working in Visual Studio SSIS using T-SQL for my projects up until now.

1. I have a combo box with Debtor Names that the user will use to select a record. I have an identity number for the key in the table and the Debtor_Last_Name as the lookup. I need to sort the Debtor Last Name in alphabetical order but when I use the sort in the property window it sorts the identity number not the name.
I also noticed that when I pick a name, it disappears from the list the next time that I access the combo box.
Display Member = Debtor_Last_Name and Value Member = Identity Number
a. I need to sort by Debtor Last Name
b. I need to refresh the combo box before I pick another name or after Adding a new Debtor.
I am using DropDownList so that the user only picks from the list.
c. The name is highlighted In blue and the font is in white and it is hard to read the name.
d. I would like to turn off the highlighting in the name combo box and set the fond color to black (like it is in the DropDown combo box) so that it is easier to read the name.

2. I have another combo box where the data in the combo box is dependent on another combo box selection. I have a Law Firm Name field and their Attorneys field.
The Attorney names should be displayed in the combo box. Display Member = Attorney Name and Value Member = Identity Number
a. I need to only show the Attorneys in the Attorney''s combo box that belong to the selected Law Firm in the Law Firm Combo Box. I need to filter the data based on the Law Firm’s identity number.
b. The Law Firm has an identity number and the Law Firm Name. The Attorneys have an identity number and Attorney Name.
c. The key to the Law Firm table is the identity number
d. The key to the Attorney table is the Law Firm identity number and the Attorney identity number.
e. How do I filter the Attorneys to only show the ones affiliated with the Law Firm?

I could do this easily in T-SQL but I have not found anything on the web that would teach me how to do the things that I need to do. I need straight forward instructions and
code so that I understand the process. I do not want to just copy code, I want to understand it.

I am assuming that I should be writing queries to do what I need done as described above but I don’t know how to go about doing it.
I do not want the user to have to click the tool bar to run a query. I want to put the code in to automatically do it … on a Click process.

Can you help me? I hope so because I need to get this done asap.
Thanks
Deb [EMAIL DELETED]

[edit]Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email (like this one) to let you know.[/edit]

推荐答案

我会调查LINQ. ''非常适合对集合进行排序...

budbjames

http://www.bytepushers.com<-我的博客
http://www.twitter.com/budbjames<-在Twitter上关注我
还要查看我的codeproject文章..

谢谢.
I would look into LINQ.. it''s great for sorting collections...

budbjames

http://www.bytepushers.com <-- my blog
http://www.twitter.com/budbjames <-- follow me on twitter
Also check out my codeproject articles..

Thanks.


这篇关于Windows窗体组合框过滤数据,刷新和排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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