C#CheckedListBox中添加带Text和Value的CheckBox
然后在代码中定义 DataTable,并和CheckedListBox 关联(CheckedListBox的名称为 receive):
DataTabledataTable =newDataTable();dataTable.Columns.Add("Text",typeof(string));
dataTable.Columns.Add("Value",typeof(string));
this.receive.DataSource = dataTable;
this.receive.DisplayMember ="Text";
this.receive.ValueMember ="Value";
向DataTable中加入DataRow对象:
DataRowdataRow = dataTable.NewRow();dataRow["Text"] = receive[1];
dataRow["Value"] = receive[0];
dataTable.Rows.Add(dataRow);
以上是 C#CheckedListBox中添加带Text和Value的CheckBox 的全部内容, 来源链接: utcz.com/z/512974.html