如何将字符串添加到组合框值 [英] How To add String to Combobox Values
本文介绍了如何将字符串添加到组合框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
cmbPurNo.DataSource = dt;
cmbPurNo.ValueMember = PSettingId;
cmbPurNo.DisplayMember = value;
这里的价值是
2
3
4
bt如何增加价值
GP2
DC3
TIN4
请帮我
解决方案
将信息添加到你的收藏中dt
更改您的查询:
SELECT PSettingId,[value],[value] + CAST( PSettingId AS VARCHAR ( 30 ))< span class =code-keyword> AS DisplayName
用法:
cmbPurNo.DataSource = dt;
cmbPurNo.ValueMember = PSettingId;
cmbPurNo.DisplayMember = DisplayName;
我会在查询中执行此操作。连接要一起显示的两列,然后将它们作为数据源分配给下拉列表。
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
解决方案
Add the information to your collection dt
Change your query:
SELECT PSettingId, [value] , [value] + CAST(PSettingId AS VARCHAR(30)) AS DisplayName
Usage:
cmbPurNo.DataSource = dt; cmbPurNo.ValueMember = "PSettingId"; cmbPurNo.DisplayMember = "DisplayName";
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.
这篇关于如何将字符串添加到组合框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文