简体   繁体   English

Windows forms C# - 如何填充 checkedComboBoxEdit1 DevExpert

[英]Windows forms C# - How populate checkedComboBoxEdit1 DevExpert

I´m new user in DevExpress and I need learning how load data into comboboxCheckbox the DevExpress windows form.我是 DevExpress 的新用户,我需要学习如何将数据加载到 DevExpress windows 表单的 comboboxCheckbox 中。

conexao = new MySqlConnection("Server=mysql.kmshow.com.br;Database=kmshow14;Uid=kmshow14;Pwd=421843unimed;");
strSQL = "SELECT Id, VENCIMENTO, NUMERO_DOC FROM financeiro_conta ";
da = new MySqlDataAdapter(strSQL, conexao);
DataTable dt = new DataTable();
da.Fill(dt);

How put "dt" in Component?如何将“dt”放入组件中?

So you need to do 3 things to get it to work: assign the dt as the datasource, set the DisplayMember to the name of the column that will be shown in the editor, and set the ValueMember for the name of the column that will be used to store data in the database.因此,您需要做 3 件事才能使其正常工作:将 dt 指定为数据源,将 DisplayMember 设置为将在编辑器中显示的列的名称,并将 ValueMember 设置为将显示在编辑器中的列的名称用于在数据库中存储数据。

The follwing code assumes that you want the Id column to be the value and the NUMERO_DOC column to be displayed to the user.以下代码假定您希望 Id 列作为值,而 NUMERO_DOC 列显示给用户。

checkedComboBoxEdit1.Properties.DataSource = dt;
checkedComboBoxEdit1.Properties.DisplayMember = dt.NUMERO_DOCColumn.ColumnName;
checkedComboBoxEdit1.Properties.ValueMember = dt.IdColumn.ColumnName; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM