gpt4 book ai didi

vb.net - 以编程方式更改 Datagridviewcombobox 的项目 VB.NET

转载 作者:行者123 更新时间:2023-12-02 05:07:04 25 4
gpt4 key购买 nike

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"

我需要做的就是为组合框添加一个处理程序来选择第一个填充的值。

有人有想法吗?

最佳答案

只需使用源中的第一项设置值。

dgvcbc.Value = cListItems(0)

关于vb.net - 以编程方式更改 Datagridviewcombobox 的项目 VB.NET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9808873/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com