2个回答
展开全部
winform comboBox 绑定数据方法
//C#
private void BindComboBox()
{
comboBox1.DataSource = dataSet1.Tables["Suppliers"];
comboBox1.DisplayMember = "数据表列名";
comboBox1.valueMember = "列名对应的值";
}
//VB
Private Sub BindComboBox()
ComboBox1.DataSource = DataSet1.Tables("Suppliers")
ComboBox1.DisplayMember = "数据表列名"
ComboBox1.DisplayMember = "列名对应的值"
End Sub
webform DropDownList 绑定方法:
private void BindDropDownList1()
{
DataTable dt = dataSet1.Tables["Suppliers"];
this.DropDownList1.DataSource = dt;
this.DropDownList1.DataTextField = "name";
this.DropDownList1.DataValueField = "fid";
this.DropDownList1.DataBind();
}
//C#
private void BindComboBox()
{
comboBox1.DataSource = dataSet1.Tables["Suppliers"];
comboBox1.DisplayMember = "数据表列名";
comboBox1.valueMember = "列名对应的值";
}
//VB
Private Sub BindComboBox()
ComboBox1.DataSource = DataSet1.Tables("Suppliers")
ComboBox1.DisplayMember = "数据表列名"
ComboBox1.DisplayMember = "列名对应的值"
End Sub
webform DropDownList 绑定方法:
private void BindDropDownList1()
{
DataTable dt = dataSet1.Tables["Suppliers"];
this.DropDownList1.DataSource = dt;
this.DropDownList1.DataTextField = "name";
this.DropDownList1.DataValueField = "fid";
this.DropDownList1.DataBind();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询