我想将Datagridview列修改为combobox列。 [英] I want to modify Datagridview column to combobox column.

查看:61
本文介绍了我想将Datagridview列修改为combobox列。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此命令在datagridview上加载数据:





I have load data on my datagridview by using this command :


Public Sub loadRepairDG()
     Dim dtDGloadRepair

     conn = GetConnect()
     Try
         da = New SqlDataAdapter("SELECT * from V_RepairInv", conn)
         ds = New DataSet()
         da.Fill(ds, "V_RepairInv")
         dtDGloadRepair = ds.Tables("V_RepairInv")
         frmRepair.DataGridViewX1.DataSource = dtDGloadRepair
     Catch ex As Exception
         MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Error conection!!")
     End Try
     conn.Close()
 End Sub



以上代码,运行正常。但后来我想将datagrid列修改为combobox。将其转换为更加动态的网格。



我读过的一些论坛上写的代码如下:




This above code, works fine. But then I want to modify the datagrid columns to combobox. Transform it into more dynamic grid.

Some forum I've read put code like this:

DatagridviewComboColumn.column.Add("1")



但它添加了列,我想将当前列从文本框修改为组合框。

我怎么可能这样做。还有可能将网格组合框链接到其他表格,而网格链接到其他表格?


But it adds column, I want to modify current column from textbox to combobox.
How can i possibly do that. And also is it possible to link the grid combobox to other table while the grid is linked to other one?

推荐答案

请阅读我对该问题的评论。 />


WinForms: DataGridViewComboBoxColumn类 [ ^ ]
Please, read my comment to the question.

WinForms: DataGridViewComboBoxColumn Class[^]


这篇关于我想将Datagridview列修改为combobox列。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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