|
-
October 13th, 2011, 05:45 PM
#11
Re: How to add Items in the DatagridViewComboboxColumn of DatagridView during runtime
I'm going to jump in (only to be ridiculed later). I believe you want to populate the ComboBox column's drop down items using Value1 & Value2. Essentially you have a two column DGV: first column has SrNo, second column has no value, yet, but the drop down items are Value1 & Value2 from that record (???). If I'm wrong stop reading now.
You can set the DropDown Items programatically, however, they will be the same for each row in the DGV (which doesn't fit your requirements). The only way I believe would be to:
1. catch the event each time the selection changes in the DGV
2. get the SrNo for that row in the DGV
3. get the Value1 & Value2 from your table which correspond to the SrNo
4. clear then add these values to the ComboBoxColumn's Items
5. may need some sort of DGV refresh/invalidate/etc. to redraw the dropdown items
This will set the Items for the entire DGVColumn, however, they should change every time you change rows.
Tags for this Thread
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
|