Hi all
I would like some help with this issue. I am new to
VB 2005 (OK with VB6)
My problem is that I cannot seem to return a structure from a function.
Example:
I defined a structure in a class (from which I instantiated an object).
One of the object methods is supposed to return a data record (a structure).
So, from the routine trying to acquire the record (a routine in a form class) I tried defining a local structure in order to receive the data from the object. But I got the following error:
Value of type 'CMA.class_ClassOne.structureOne' cannot be converted to 'CMA.frmFormOne.structureTwo'.
(even though they both have identical elements!)
Next, I tried defining a local variable of type object to recieve the data record. This seems to work in that I can seemingly retrieve the record, but now I cannot fill a datagridview with the data (which was the whole point). It seems as though it doesn't actually retrieve the data somehow. That is, I can assign the elements which (apparently) belong to the local object variable to particular rows and columns of the datagridview, but nothing happens: the grid remains blank.
More pictorially:
some class... some protected friend structure
(I had to make it friend, because I got an error that the function couldn't expose the structure if it was private)
... some function returns variable of type structure
(that is the above defined structure)
end some class
some other class (a form)
... define local structure to have the same elements as structure in some class (in order to retrieve data from some class)--- Get can't convert error
Tried this next:
... define local variable of type object: No error, but doesn't seem to work
end some other class
Any help to understand (and fix) what is going on here would be greatly appreciated. My project development has kind of stalled now.
Sincerely,
--Mike