如何在datagride视图中添加组合框一个单元格? [英] How add combobox ton one cell in datagride view ?

查看:78
本文介绍了如何在datagride视图中添加组合框一个单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Datagrideview包含4个cloumns和5行。

所有单元格都是文本框类型



i想要改变cloumns的单元格类型( 3)从文本框到组合框的第(2)行





这是图片的链接我想要什么



从这里开始。



我的项目在vb.net

和数据库访问2003



谢谢。



我尝试了什么:



当我搜索我发现代码添加所有cloumns我不需要

my Datagrideview contains 4 cloumns and 5 rows.
all cells are textbox type

i want to change type of cell at cloumns(3) row(2) from textbox to combobox


this is link to picture what i want

from here.

my project in vb.net
and databse access 2003

thank you .

What I have tried:

when i search i found code add all cloumns i dont need that

推荐答案

我不知道这是否适用于你的系统,但是...

I have no idea if this will work in your system, but...
DataGridViewComboBoxCell myCell = new DataGridViewComboBoxCell();
myCell.Items.AddRange("Hello", "there", "world");
myDataGridView.Rows[2].Cells[3] = myCell;

会这样做。

但是,根据现有数据的来源,您可能会收到DataError异常。

Will do it.
However, depending on the source for your existing data, you may get DataError exceptions.


这篇关于如何在datagride视图中添加组合框一个单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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