I was wondering if there are any VB gurus on this board. I would have posted this to a VB board, but it does concern kix, in a way.

I'm trying to teach myself VB and I thought a good first project would be to create a DLL that I could use with kix. Basically, once the dll is registered you can use createobject to make a poor-man's structure.

But I'm having problems passing strings from kix to my dll. I'm just hoping someone out there can show me the way. Here's the VB code for my class.

code:
  
'declarations
Private propertyNames() As Variant
Private propertyValues() As Variant
Private declared As Boolean

'intitialize class
Private Sub Class_Initialize()
declared = False
End Sub


'add properties to the struct
Public Sub addProps(props() As Variant)
If Not delcared Then
ReDim propertyNames(LBound(props) To UBound(props)) As Variant
ReDim propertyValues(LBound(props) To UBound(props)) As Variant
propertyNames = props
declared = True
End If
End Sub



'give a property a value
Public Sub setProperty(pName As Variant, data As Variant)
Dim size As Integer
size = UBound(propertyNames)
If declared Then
For j = 0 To size
If propertyNames(j) = pName Then
propertyValues(j) = data
Exit For
End If
Next
End If

End Sub



'retrieve a properties value
Public Function getProperty(pName As Variant) As Variant
Dim size As Integer
size = UBound(propertyNames)
If declared Then
For j = 0 To size
If propertyNames(j) = pName Then
getProperty = propertyValues(j)
Exit For
End If
Next
End If
End Function

And here is a sample kix script to use the dll

code:
break on

$employee1 = employeeStruct()
$employee1.setProperty("Name", "Eric")
$employee1.setProperty("ID", "1234567")
$tempName = $employee1.getProperty("Name")
? "name: " $tempName
exit

Function employeeStruct()
dim $myprops
dim $emp
$myprops = "Name", "ID", "Number"
$emp = createobject("kixStuff.kixStruct")
$emp.addProps($myprops)
$employeeStruct = $emp
endfunction

My problem, right now at least, is that the addProps method in the vb class doesn't seem to understand what kix is passing it. I'm new VB, so I hope someone more experienced may be able to spot what's wrong. And any other suggestions, shortcuts or Criticisms are welcome

Keep in mind I'm just playing around so the dll, as of right now, is not at all robust.
_________________________
Eric