Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello There

I have a C# application in which there is 1 ListBox, 2 TextBoxes and 1 ComboBox.
The data in ListBox is fetch by a table in which there is NO unique column so listbox may contains duplicate value. Currently there are 3 duplicate values (for column user_name) but there corresponding fields are different (dept_Code,Join_Date). The query to fetch data is:
C#
Select * from adj_User Where User_Name='" + List1.Text + "'


So when the user click on the duplicate value (user_name) the TextBox and ComboxBox display the same value (0th index).

Is there any solution. I tried to use MultiColumn so I can use two columns user_name and dept_code in it and according to this I can change query.

Need Suggestion
Posted
Comments
Jameel VM 6-Feb-13 0:25am    
Please post your code what you have tried?
Sergey Alexandrovich Kryukov 6-Feb-13 1:55am    
Is it System.Windows.Forms or not?
—SA
Mayank Topiwala 6-Feb-13 2:03am    
Yes it is a Windows Form.

1 solution

There is no such thing as multi-column ListBox. If you can, consider System.Windows.Forms.ListView (you did not tell us what UI library do you use) — it can be multi-column.

—SA
 
Share this answer
 
Comments
Mayank Topiwala 6-Feb-13 0:41am    
Ok forget the MultiColumn ListBox and if you understand my problem, do u have any solution available.
Thanks
Sergey Alexandrovich Kryukov 6-Feb-13 1:55am    
Yes, you do, if you use System.Windows.Forms, you have the option I just described...
Another closest option is some grid view, such as System.Windows.Forms.DataGridView,
And second closest is the custom control...
—SA
Mayank Topiwala 6-Feb-13 2:04am    
What about custom control ?
Sergey Alexandrovich Kryukov 6-Feb-13 2:12am    
I mean, develop a class derived from Control and do whatever you want in it, render all graphics inside it, etc. This is pretty much doing it all from scratch. I see, you answered: this is Windows.Forms. Then ListView can be used... See its documentation, it's clear enough.
—SA
Mayank Topiwala 6-Feb-13 2:47am    
Ok thanx Sergey.

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