DataGridView ComboBox列 [英] DataGridView ComboBox Column
本文介绍了DataGridView ComboBox列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个VB.Net应用程序。我在表单中有一个datagridview并使用datasource绑定。
绑定后假设datagridview结构如 -
column1 | column2 | column3 | column4 | column15
--------------------------------------------- --------
值1 |价值2 |价值3 |价值4 |值5
值1 |价值9 |价值3 |价值4 |值5
您只能看到column2具有不同的值。现在我想要添加第二行(重复)值(值2和值9)显示在第1行的组合框中
解决方案
这基本上是书店应用程序。假设任何客户想要特定类的书籍,所有具有详细信息的书籍都在datagridview中加载。 1本书可以有多个版本。我希望那些书有多个版本显示在单行中,可以选择选择版本(可以是组合框)。
我绑定了datagridview但未能生成上述描述结构
Dim conn 正如 SqlConnection = 新 SqlConnection(connectionString)
conn.Open()
Dim 命令作为 SqlCommand
命令= 新 SqlCommand( invoice_sales_board_class_all,conn)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add( @ board,SqlDbType.NVarChar).Value = board_name
command.Parameters.Add( @ cla ss,SqlDbType.NVarChar).Value = class_name
command.Parameters.Add( @storeid,SqlDbType.Int).Value = public_store_id
Dim adapter 正如 SqlDataAdapter = 新 SqlDataAdapter(命令)
adapter.Fill(ds)
DataGridView1.AutoGenerateColumns = False
DataGridView1.DataSource = ds.Tables( 0 )
conn.Close()
Hi,
I am creating a VB.Net Application. I have a datagridview in form and bind using datasource.
After bind suppose the datagridview structure like -
column1 | column2 | column3 | column4 | column15
-----------------------------------------------------
value 1 | value 2 | value 3 | value 4 | value 5
value 1 | value 9 | value 3 | value 4 | value 5
You can see only column2 has different values. Now i want instead on adding 2nd row (duplicate) both the value (value 2 and value9 ) show in combobox of row 1
解决方案
This is basically a book store application. Suppose any customer wants the books of particular class, all the books with detail load in datagridview. 1 book can have multiple edition. I want those books have multiple edition show in single row with option of choose edition (can be combobox).
I have bind the datagridview but failed to produced above describe structure
Dim conn As SqlConnection = New SqlConnection(connectionString) conn.Open() Dim command As SqlCommand command = New SqlCommand("invoice_sales_board_class_all", conn) command.CommandType = CommandType.StoredProcedure command.Parameters.Add("@board", SqlDbType.NVarChar).Value = board_name command.Parameters.Add("@class", SqlDbType.NVarChar).Value = class_name command.Parameters.Add("@storeid", SqlDbType.Int).Value = public_store_id Dim adapter As SqlDataAdapter = New SqlDataAdapter(command) adapter.Fill(ds) DataGridView1.AutoGenerateColumns = False DataGridView1.DataSource = ds.Tables(0) conn.Close()
这篇关于DataGridView ComboBox列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文