I recently picked up the book Business Objects for Visual BASIC 6.0 published by Wrox. I must admit it provides some interesting reading and some concepts which I've not used before, primarily the use of UDTs to pass data. However, it is in this area that I am experiencing problems.
I have one block of code that is:
Private Function GetState() As String
Dim udtData As EmployeeData
LSet udtData = mudtProps
GetState = udtData.Buffer
mudtProps is a 'normal' UDT with individual properties that make up an employee (name, employee ID, etc.). udtData/EmployeeData is a UDT with a single property, Buffer. Buffer is defined as String * 972. When I run this code, I get a Compile Error: Type Mismatch.
When I go into immediate mode and use the Lenb() function on udtData, mudtProps and udtData.Buffer, they all come out the same length, 972. The error occurs on the LSET line.
Any ideas? If we get somewhere positive on this thread, I may have another question or two along the same lines, primarily, is there an EASY way to calculate the length of the buffer for the individual primary UDTs? Some seem straight-forward, but I've got some that have variant, boolean, string, long, integer and what-not different data types within the properties.
Is doinga Lenb() on the 'Primary' UDT and using that value as the value of the buffer a safe way to go or are there other factors you need to take into account?