Click here to Skip to main content
15,942,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

[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]
Updated 2-Aug-10 9:00am

1 solution

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

budbjames <-- my blog <-- follow me on twitter
Also check out my codeproject articles..

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900