2012-03-21 23 views
3
Dim cListItems As New System.Collections.Generic.List(Of Combobox_values) 
       If ds.Tables("items_prices").Rows(0).Item("item_selldozen") > 0 Then 
        Dim item_selldozen As String = ds.Tables("items_prices").Rows(0).Item("item_selldozen") 
        cListItems.Add(New Combobox_values("Dozen", item_selldozen)) 
       End If 

       Dim dgvcbc As DataGridViewComboBoxCell = DirectCast(CType(main.ActiveMdiChild, discount_new_discount).discountitems_new_discount.Rows(last_row).Cells(3), DataGridViewComboBoxCell) 
       dgvcbc.DataSource = cListItems 'Fill cListItems 
       dgvcbc.DisplayMember = "Text" 
       dgvcbc.ValueMember = "Value" 

私が行う必要があるのは、コンボボックスのHandlerを追加して最初の値を選択することだけです。Datagridviewcomboboxの項目をプログラムで変更VB

誰もがアイデアを持っていますか?

答えて

0

ソースの最初の項目を使用して値を設定するだけです。

dgvcbc.Value = cListItems(0)