填充datagrid视图的组合框类型Coloumn [英] Fill datagrid view's combobox type Coloumn

查看:108
本文介绍了填充datagrid视图的组合框类型Coloumn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有一个表。

表名是DCD

SNO RNO VALUE

1 1 A

1 2 B

1 3



和数据网格视图名称为DB1



先生我创建了一个具有rno和value的数据表rt。

,数据集名称为ds。





现在先生我想用数据网格视图组合框中的所有值填充DCD表值字段的值。





帮我解决这个问题

I HAVE ONE TABLE in the database .
Table name is DCD
SNO RNO VALUE
1 1 A
1 2 B
1 3 C

and a datagrid view name as DB1

Sir I create a datatable rt that have rno and value .
and the dataset name is ds.


Now sir i want to fill all the values in the datagrid view combobox type coloumn withe the values of the Value Field of DCD table.


Help me regarding this

推荐答案

尝试类似:

Try something like:
DataGridViewComboBoxCell cbCell = (DataGridViewComboBoxCell)myDataGrid.Rows[0].Cells[2];
cbCell.Items.Add(.....);



参考: MSDN:DataGridViewComboBoxCell [ ^ ]和 MSDN:DataGridViewComboBoxCell.Items [ ^ ] property。



示例:在DataGridView控件中添加一个组合框列 [ ^ ]

这里使用不同方法的简短教程:绑定DataGridView ComboBox列 [ ^ ]





试用。如果你面临发布具体问题。


Refer: MSDN: DataGridViewComboBoxCell[^] and MSDN: DataGridViewComboBoxCell.Items[^] property.

Sample: Host a combo box column within a DataGridView control [^]
A short tutorial here using different approach: Binding DataGridView ComboBox Column [^]


Try out. Post specific issue if you face.


先生



i从数据库中取值。

so我想知道datagrid视图组合框类型coloumn如何填充我的数据表。
sir

i take the values from database.
so i want to know how the datagrid view combobox type coloumn fill throgh my datatable .


这篇关于填充datagrid视图的组合框类型Coloumn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆