且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将数据绑定到DatagridCombobox

更新时间:2022-06-19 03:04:45

我认为为此目的使用键入的DataSet会很容易.
您可以看一下这篇文章
用于从DataBase和使用反射将DataTable保存到数据库中 [ http://msdn.microsoft.com/en-us/library/system. windows.forms.datagridviewcomboboxcolumn.aspx [ ^ ]
I think it will be easy to use typed DataSets for this purpose.
You can take a look at this article
General purpose class to fill DataTable(s) from DataBase and to save DataTable(s) to DataBase using reflection[^]
for easily filling the DataTables from database and saving DataTables to database.

Then to bind the DataGridViewComboboxColumn
set the DataSource property to your DataTable and
ValueMember, DisplayMember properties to field required in the table.

An example is given here
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcomboboxcolumn.aspx[^]