小编Mar*_*tin的帖子

使用字典作为组合框数据源

我想从字典源填充组合框。该字典有一个类值,我想将类属性用于组合框值。

示例类

Public Class Customer
    Public ID As Integer
    Public Name As String
    Public Address As String
    Public City As String

    Public Sub New(ByVal newID As Integer, ByVal newName As String, ByVal newAddress As String, ByVal newCity As String)
        ID = newID
        Name = newName
        Address = newAddress
        City = newCity
    End Sub
End Class
Run Code Online (Sandbox Code Playgroud)

表格示例

Public Class Form1
    Dim Customers As New Dictionary(Of Integer, Customer)

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Customers.Add(341, New Customer(341, "Michael", …
Run Code Online (Sandbox Code Playgroud)

vb.net combobox dictionary

2
推荐指数
1
解决办法
5469
查看次数

标签 统计

combobox ×1

dictionary ×1

vb.net ×1