Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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
Posted
Updated 2-Jan-13 20:49pm
v2
Comments
Abhishek Pant 3-Jan-13 2:54am    
genrate the combobox at runtime
[no name] 3-Jan-13 20:06pm    
Copy your data selection and data binding code here.

You need to bind your combobox at datagridview DataBound level.

1 solution

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

VB
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()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900