vb 中怎样将自定义用户类型作为函数的参数传递
DimCPAsMCDimC_PAsMCPrivateTypeMCIdAsStringHong(1To6)AsIntegerLanAsIntegerEndType此代码在通...
Dim CP As MC
Dim C_P As MC
Private Type MC
Id As String
Hong(1 To 6) As Integer
Lan As Integer
End Type
此代码在 通用段
Public Function BiJiao(ByRef CP As MC, ByRef C_P As MC) As intger
p = 0
sum = 0
For i = 1 To 6
For j = 1 To 6
If CP.Hong(i) = C_P.Hong(i) Then sum = sum + 1
Next j
Next i
If CP.Hong.Lan = C_P.Lan Then p = 7
BiJiao() = sum + p
End Function
一运行 老是说我的用户类型未定义
我传递的参数是 数组类型的 也就数组中的一个 展开
Dim C_P As MC
Private Type MC
Id As String
Hong(1 To 6) As Integer
Lan As Integer
End Type
此代码在 通用段
Public Function BiJiao(ByRef CP As MC, ByRef C_P As MC) As intger
p = 0
sum = 0
For i = 1 To 6
For j = 1 To 6
If CP.Hong(i) = C_P.Hong(i) Then sum = sum + 1
Next j
Next i
If CP.Hong.Lan = C_P.Lan Then p = 7
BiJiao() = sum + p
End Function
一运行 老是说我的用户类型未定义
我传递的参数是 数组类型的 也就数组中的一个 展开
2个回答
展开全部
Private Function BiJiao(ByRef CP As MC, ByRef C_P As MC) As Integer ’intger写错了
p = 0
Sum = 0
For i = 1 To 6
For j = 1 To 6
If CP.Hong(i) = C_P.Hong(i) Then Sum = Sum + 1
Next j
Next i
If CP.Lan = C_P.Lan Then p = 7 ‘CP.Hong.Lan写错了
BiJiao = Sum + p ‘BiJiao()不能打括号
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询