如何以编程方式填充组合框 [英] how to populate a combo box programmatically
本文介绍了如何以编程方式填充组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请介绍一下如何在Windows应用程序中使用C#在运行时以编程方式填充组合框
? [confused]
Please can some describe how to
programmatically populate a combo box
at runtime in a windows application
using C#? [confused]
推荐答案
从db&分配给数据表.然后分配给组合框.
get the data from db & assign to datatable. Then assign to combobox.
dropdownlist1.DataTextField = "Textfield";
dropdownlist1.DataValueField = "Valuefield";
dropdownlist1.DataSource = datatableData;
dropdownlist1.DataBind();
这篇关于如何以编程方式填充组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文