|
-
Feb 12th, 2004, 10:16 AM
#1
Thread Starter
Addicted Member
Dynamic array, loss of decimal point after redim
Hi all
I have got a dynamic array declared as :
public tmpChase() as single
It is going to be a multidimensional array and the data is being read from a standerd "," (comma???) delimeted text file. I read the data using :
VB Code:
Nr = FreeFile
Open strOpen For Input As #Nr
Do While Not EOF(Nr)
'Array aanpassen
ReDim Preserve tmpChase(MaxChannels, tmpMaxStep)
For i = 0 To MaxChannels
Input #Nr, Inputstring
tmpChase(i, tmpMaxStep) = CSng(Inputstring)
Next i
tmpMaxStep = tmpMaxStep + 1
Loop
Close #Nr
so the code reads goes to the first line in the text file, reads al the values and then goes to the next line. Before it starts to read again the array is made bigger and i use Preserve because i want to keep the old data. No problems with the code so far and everything works alright.
Except when the values that are being read contain a decimal point. When i check they array right after a field is being read then i get the correct answer (let''s say 1.5). But when i later on test again i loose the decimal value and only get 5. I think this has something to do with Redim Preserve. But they array has been declared as single, so it shouldn't be a problem
Regards,
per-i
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|