From: Mike Williams on
On 7 Nov, 18:05, Scorpion_1982 <Scorpion_1...(a)o2.pl> wrote:

> 2. How to check what kind of variables
> one after another a structure contain
> without knowing the structure.


Again, I'm not quite sure what you mean? Do you mean that you want to
somehow examine an existing data string (a string of the kind that
might have been saved to file using the VB Put method on a UDT, or
perhaps and equivalent string that was produced by the alternative
"Put without using a disk file" that I posted a while ago?

Do you want to either load such a string from disk (a standard format
saved UDT string) or from your serial port and somehow work out what
kind of UDT it should go into (the various types of variable in the
UDT)? If that's what you want to do then it is not possible. As far as
the VB Get method is concerned the data it "Gets" is just a string of
data and it is totally meaningless without your code first "telling"
VB what the data actually represents. In other words, the only way VB
knows how to handle the data when you use Get to load it into a UDT is
because your code has already declared a UDT of the exact required
kind. The VB Get method then knows all about the required format of
the data it is getting because an instance of that specific UDT is
included as one of the arguments of the Get statement. Exactly the
same reasoning applies to the "Get without using a disk file" in the
code I previously posted.

If you want to write code that can actually do the sort of thing you
are suggesting then you can of course do so, but in order to do so the
details of the various variable types and the order that they appear
in the UDT must be saved as part of the data string itself that you
save to file (or to wherever else you wish to save or send it). In
other words, you will need to create your own special data format and
write your own special code that understands that format when both
saving and loading data. But the data you end up with will then be
something completely different from a standard VB UDT. If you don't
want to go to the trouble of writing all the extra code that would be
required then standard databases are of couse capable of working in
such a fashion (that is their job) so perhaps you might consider using
one of them. You would of course then be using "stuff that is not
included in the basic VB runtime", which I seem to recall is something
that you do not wish to do. And, of course, your data would n ot be in
the same form at as a standard VB UDT.

So, it really isn't possible to answer either of your questions until
you tell us in m ore detail exactly what you are trying to achieve.

Mike