fileput and fileget problems

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Hi,

I have a VB6 program that I am rewriting in .Net, and in the VB6 program I
have a type defined:

Private Type typSound
filename As String
buffer As String
End Type

and an array of that defined:

Dim mSounds() as typSound

This is redimensioned as required and I write it out with a

Put #1,,mSoundCount ' where mSoundCount is the Ubound of mSounds
Put #1,,mSounds

I read this in with:

Get #1,,mSoundCount
Redim mSounds(1 to mSoundCount)
Get #1,,mSounds

This all works beautifully under VB6, but I am trying to do something
similar in .Net and it just doesn't isn't working for me.

Can anybody convert the above code into the .Net equivalent that actually
works? I have tried:

FilePutObject(1, mSoundCount) ' mSoundCount is a Long
FilePutObject(1, mSounds)

Sometimes I get "Arithmetic operation resulted in an overflow", and I
believe this might be something to do with the size of the buffer variable,
but if it works and I read it back with:

FileGetObject(1, mQuestionCount)
ReDim mQuestions(mQuestionCount)
FileGetObject(1, mQuestions)

I get Variable uses an Automation type not supported in Visual Basic. If it
lets me write the array, surely it should let me read it back?


Regards and thanks,

Richard
 
Back
Top