Click here to Skip to main content
15,905,414 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
cmbPurNo.DataSource = dt;
cmbPurNo.ValueMember = "PSettingId";
cmbPurNo.DisplayMember = "value";

here values are
2
3
4


bt how to add value to like
GP2
DC3
TIN4


pls help me
Posted
Updated 17-Apr-13 20:22pm
v2
Comments
OPees 18-Apr-13 2:18am    
can you brief it more? what are in PSettingId?
Maciej Los 18-Apr-13 2:23am    
Please, be more specific and provide more details.
Amarender1479 18-Apr-13 2:31am    
i've combobox values as 2
3
4
bt how to add string to that values GP2
DC3
TIN4
Maciej Los 18-Apr-13 2:34am    
See my answer, please...
Amarender1479 18-Apr-13 2:23am    
here PsettingId is Table Id
where PsettingId is 1 Value is 2
3
4
bt how to add string to values in c#

Add the information to your collection dt
 
Share this answer
 
Change your query:
SQL
SELECT PSettingId, [value] , [value] + CAST(PSettingId AS VARCHAR(30)) AS  DisplayName


Usage:
C#
cmbPurNo.DataSource = dt;
cmbPurNo.ValueMember = "PSettingId";
cmbPurNo.DisplayMember = "DisplayName";
 
Share this answer
 
Comments
Amarender1479 18-Apr-13 2:54am    
thanks
Maciej Los 18-Apr-13 2:57am    
You're welcome ;)
Please, mark all useful answers as "solved" (green button). It would be nice to see how useful answer is (use voting system).
I would do this in the query. Concatenate the two columns you want to show together and then assign them as the datasource to the dropdown.
 
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