有一个名为 cboEndUser 的组合框。当我在组合框中选择项目时,会调用此函数。cboEndUser 由
cboEndUser.Items.Add(New itemData(oRec.Fields("FullName").Value, oRec("ContactID")))
项目数据是一个类。
Public Class itemData
Public _item As String
Public _itemData As Object
Public Sub New(ByVal item As String, ByVal data As Object)
_item = item
_itemData = data
End Sub
Public Overrides Function ToString() As String
Return _item
End Function
End Class
Private Sub cboEndUser_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cboEndUser.SelectedIndexChanged
If cboEndUser.SelectedIndex <> -1 Then
PopulateSerialNumberArray(CInt(txtCustomerID.Text), (cboEndUser.SelectedItem)._itemData)
End If
End Sub
在 PopulateSerialNumberArray(CInt(txtCustomerID.Text), (cboEndUser.SelectedItem)._itemData) 行中获取错误。错误是从“InternalField”类型到“String”类型的转换无效。
Public Sub PopulateSerialNumberArray(ByRef plCustomerID As Integer, ByRef plContactID As String)
End Sub