Home All Groups Group Topic Archive Search About

Random Access Torture!

Author
12 Jan 2006 9:42 PM
tomb
VB.Net 2003
I can't understand why, if I can use FilePut to write a structure to a
random access file, I can't use FileGet to read that structure back in
again.  I get this error when reading:
"Object type cannot be converted to target type."

There shouldn't be any conversion necessary - it's the same structure!

Help, please...

Tom

Author
12 Jan 2006 10:24 PM
Ken Tucker [MVP]
Hi,

            You did not give much to go with.  If the file is also used with
vb6 remember that a vb.net integer is a vb6 long, and vb.net short is a vb6
integer.

Ken
-----------------
Show quoteHide quote
"tomb" <t***@technetcenter.com> wrote in message
news:72Axf.36342$qw4.23605@bignews5.bellsouth.net...
> VB.Net 2003
> I can't understand why, if I can use FilePut to write a structure to a
> random access file, I can't use FileGet to read that structure back in
> again.  I get this error when reading:
> "Object type cannot be converted to target type."
>
> There shouldn't be any conversion necessary - it's the same structure!
>
> Help, please...
>
> Tom
Author
13 Jan 2006 2:30 PM
tomb
Ken,
This is only in VB.Net 2003.  I write to the file with this structure,
no problem.  But I can't read the file with the same structure.  I get
that error message.

I trie FilePutObject and FileGetObject, but I can't put it - I get this
error message:
"'FilePutObject' of structure 'doc_Specs' is not valid.  Use 'FilePut'
instead."

So, if I can't use FilePutObject, but I can't FileGet a file with the
structure that FilePut the file, what is a programmer to do?
It just doesn't make sense.

Tom


Ken Tucker [MVP] wrote:

Show quoteHide quote
>Hi,
>
>            You did not give much to go with.  If the file is also used with
>vb6 remember that a vb.net integer is a vb6 long, and vb.net short is a vb6
>integer.
>
>Ken
>-----------------
>"tomb" <t***@technetcenter.com> wrote in message
>news:72Axf.36342$qw4.23605@bignews5.bellsouth.net...

>
>>VB.Net 2003
>>I can't understand why, if I can use FilePut to write a structure to a
>>random access file, I can't use FileGet to read that structure back in
>>again.  I get this error when reading:
>>"Object type cannot be converted to target type."
>>
>>There shouldn't be any conversion necessary - it's the same structure!
>>
>>Help, please...
>>
>>Tom
>>   
>>
>
>

>