borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (SSTab Issues)Next Topic (VB6: Open Excel) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Errors with text files
Poster Message
Oracle
Level: Graduate

Registered: 07-04-2004
Posts: 12

icon Errors with text files

I have a VB6 application, which reads and write to a text file.  The application is used thought the world however for a very small number of users then the program write to the file they get an overflow error.  

It looks as if it only happens with XP
And the user has addition character set installed

What is more puzzling is that all the uses are writing the same data!  

Can anyone help?


Oracle

12-01-2005 at 05:38 PM
View Profile Send Email to User Show All Posts | Quote Reply
pavane
Level: VB Lord

Registered: 26-04-2004
Posts: 179
icon Re: Errors with text files

Maybe it is due to using one of the character sets in which each character occupies 2 bytes instead of 1?

13-01-2005 at 08:23 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 907
icon Re: Errors with text files

I'll give you some offhand reflections...

- You should know what point in the code has generated the overflow error. (Do you know it? If you don't, thare are some techniques to get it). The error could be bypassed either from within the code or from within the text file values. I'll try to explain it better.
Let's suppose we read the value 33000 from the text file. I could dim a Long variable to store it, or I could write a lower number into the text file. It depends on how the text file is generated and how its values are used (you didn't tell us).

- If the text file has been generated by your VB application, it could be some IDE/Exe conversion trouble, and this is tricky to identify. For instance, once I cranked my head on a Type mismatch error when reading an INI file. This file was updated during previous app-unload phase, and contained the value of some variables. Only, when I ran the .exe, the variable values were correctly stored, but when I ran the app into the VB IDE, the boolean values were translated into the local language of the pc, so it wrote "Vero" or "Falso" instead of "True" or "False". It took me one week to locate the error. You may want to check for a similar case.

- In general words, even if you declare a numeric variable, VB internally uses a Long or a Double variable (...from MSDN...), so you'll have no relevant advantage to declare an Integer or a Single. Then in most cases you can convert your variables into a larger type with no regrets.

- If at the end you discover the problem is due to machine's installed charachter set, you may include your desired charset into a setup package with your app, and deliver it to your users.

Hope it helps

____________________________
Real Programmer can count up to 1024 on his fingers

13-01-2005 at 11:10 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Errors with text files
Previous Topic (SSTab Issues)Next Topic (VB6: Open Excel) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder