I
imme929
How do I do it? Nothing in the books is helpful.
I need to save a structure with different data types.
I need to save a structure with different data types.
imme929 said:How do I do it? Nothing in the books is helpful.
I need to save a structure with different data types.
* imme929 said:How do I do it? Nothing in the books is helpful.
I need to save a structure with different data types.
William said:imme: Look on Google for VB.NET & Serializable. It's an attribute and you
can mark up your Structures or your classes with it. From there, you can
implement the serialization however you want, there are tons of examples out
there but treat it just like a class. You'll need to decide what format you
want it saved in (Binary, SOAP, XML, Text) and that will dictate how you
proceed.
imme929 said:I got things working until I tried this...
Public Enum Keyboard
EnglishUS
EnglishUK
Spanish
German
Italian
French
End Enum
Public Structure TUserStats
Public language As Keyboard <----------
Public User As String
Public BestPercentage As String
Public BestCompleted As Integer
Public BestAverage As Single
End Structure
The arrow above points to the problem. I'm stopped at
this line below:
FileGet(1, Globals.RecStats)
An error window pops up and says....
"An unhandled exception of type 'System.ArgumentException'
occurred in microsoft.visualbasic.dll"
"Additional information: Object type cannot be converted
to target type."
'..
Armin said:Are you sure you saved the same Structure in the file? Is it saved at the
same position as you read from? Can you show use the code how you wrote the
Structure to the file?
imme929 said:Are you sure you saved the same Structure in the file? Is it saved
at the same position as you read from? Can you show use the code
how you wrote the Structure to the file?
The code below works fine until the 3 lines commented
are uncommented. then it stops with the error message.
Code:[/QUOTE] After disabling Option Strict, the code runs without an error, here. -- Armin How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Cor Ligthert said:??????
I do not understand this
To solve the problem, I have to create the same conditions as the OP has. To
do this, I have to disable option strict. Even if I do it, there is no
error. This does not mean one should disable option strict, but it was the
only way to find out if the error can be reproduced.
Cor Ligthert said:I did understand that of course, however I could not resist to give
you this answer in this case.
)