Based on reference dll example
VB code, I try to created a some class
as
Imports System
Imports System.Collections
Imports Microsoft.VisualBasic
Public Class myclass
Public m_name As String
Public m_guid As String
Public m_fstatus As Char
Public Property name() As String
Get
Return m_name
End Get
Set(ByVal value As String)
m_name = value
End Set
End Property
Public Property guid() As String
Get
Return m_guid
End Get
Set(ByVal value As String)
m_guid = value
End Set
End Property
Public Property fstatus() As String
Get
Return m_fstatus
End Get
Set(ByVal value As String)
m_fstatus = value
End Set
End Property
Public Function getname() As Collection
Dim tname As New Collection
tname.Add(m_name)
MsgBox("name-" & m_name)
Return tname
End Function
Public Function getid() As Collection
Dim tid As New Collection
tid.Add(m_guid)
MsgBox("id--" & m_guid)
Return tid
End Function
Public Function getflag() As Collection
Dim tflag As New Collection
tflag.Add(m_fstatus)
MsgBox("flag-" & m_fstatus)
Return tflag
End Function
Public Sub getvideo()
'test function code
For i As Integer = 1 To 10
m_name = "jimmy" & i
m_guid = "1111" & i
If m_guid Is DBNull.Value Then
m_fstatus = "O"
Else
m_fstatus = "A"
End If
Next
End Sub
End Class
I passed build dll without error.
I call reference this dll in form and call calss in procedure as
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim classObject As New myclass
Dim fname As New Collection
Dim fid As New Collection
Dim fflag As New Collection
fname = classObject.getname()
fid = classObject.getid()
fflag = classObject.getflag()
Try
If fname.Count <> 0 Then
For i As Integer = 1 To 10
MessageBox.Show(fname(i))
Debug.Print("show: " & CStr(fname(i)))
Next
Else
Debug.Print("no show: ")
End If
Catch ee As NullReferenceException
MessageBox.Show("No Error code: 010001 " & vbCrLf & ee.Message)
Beep()
Exit Sub
End Try
End Sub
But I can call myclass.getneme with a error as "Collection index must be in the range 1 to the size of the collection."
note: there are no value at first loop.
How to build a class with output as classname.functionname in collection
*******************************
Example code:
Visual Basic example
Dim objEntityList As ListEntityProxy
Dim oEntity As Object
Set objEntityList = UIProxy.ListEntityProxy
For Each oEntity In objEntityList
Debug.Print oEntity.Name
Debug.Print oEntity.type
Debug.Print oEntity.phone
Next
classname.function
ListEntityProxy as collection
UIProxy as class instance name
ListEntityProxy as property
jimusa