Click here to Skip to main content
12,953,014 members (44,321 online)
Rate this:
 
Please Sign up or sign in to 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 2-Jan-13 20:35pm
kals84713
Updated 2-Jan-13 20:49pm
v2
Comments
Abhishek Pant 3-Jan-13 2:54am
   
genrate the combobox at runtime
Sheikh Muhammad Haris 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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 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()
  Permalink  

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,920


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100