I write the following testing code for checking how I can pass user defined type in function running well with in module. But when I made the same the function in class it
Not works? Give me the Error
Only Public User Defined Types Defined In Public Object Module Can Be Used As Parameters Or Return Types For Public Procedures of Class Modules Or as Fields of public User Defined Types
How can I make the same function in Class?
VB Code:
Public Type MyType ' In Module First As String Second As Long End Type Public Function TestType(ByRef TypeIN() As MyType) 'In Module Dim A As Integer For A = 1 To 2 MsgBox TypeIN(A).First & TypeIN(A).Second ' Get Data TypeIN(A).First = "Test" & A 'Set Data TypeIN(A).Second = A 'Set Data Next A End Function Private Sub Command1_Click() Dim TestingType(1 To 2) As MyType TestingType(1).First = "First A" ' Set Data TestingType(1).Second = 1 'Set Data TestingType(2).First = "First B" TestingType(2).Second = 2 Call TestType(TestingType()) MsgBox TestingType(1).First & TestingType(1).Second ' Get Data MsgBox TestingType(2).First & TestingType(2).Second ' Get Data End Sub




Reply With Quote