|
-
Aug 10th, 2011, 02:11 AM
#1
Thread Starter
Member
DatagridviewComboBoxColumn Dynamically populating items collection
Hi,
I am trying to create a basic quoting tool but got stuck on how to clear and change the item collection from within a combobox for a datagrid.
What we have is a list of 4 columns like
a. Device b.TypeofService c.State d.Price
Inside a sql database. Data is also structure like above as well.
I have a datagridview where the user will populate a,b,c and the price will be display and a total at the end. However a,b, and c aren't related in my current application. The combobox will show all possible dinstinct values for each column.
This works fine but I want to refine the application to only show the values of b. which are in the database after the user select the value for a. I have tried searching on how to do this as I assume to the Contry/State/City situation but could not find anything for a datagridview control in VB.NET.
Can anyone point me in the right direction? If I cannot do this dynamically from within a datagridview I was thinking of maybe creating three combo box outside and having it populating the datagridview afterwards but it wouldn't be as nice.
-
Aug 10th, 2011, 02:37 AM
#2
Re: DatagridviewComboBoxColumn Dynamically populating items collection
You will need to handle the EditingControlShowing event of the grid. In the event handler, you can get access to the row and column indexes and the ComboBox control itself, so you can determine what should be shown and then show it.
-
Aug 10th, 2011, 06:11 AM
#3
Thread Starter
Member
Re: DatagridviewComboBoxColumn Dynamically populating items collection
I am using these event handlers to calculate the price. However I have no idea how to clear the items colection for one row and update it with new values. I dont want to update the items collection for all prrevious column calues as it might alter the perviously populated rows.
-
Aug 10th, 2011, 07:30 AM
#4
Re: DatagridviewComboBoxColumn Dynamically populating items collection
All you're changing is the items in the ComboBox being used to edit the current cell.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|