|
-
Oct 4th, 2002, 08:23 AM
#1
Thread Starter
Lively Member
Waar/Onwaar instead of True/False when writing to file...
I have a real strange language problem...
VB Code:
TextInfo = "pblnBlaa|" & pblnBlaa & vbCrLf
Open bla.txt For Output As #fnum
Print #fnum, TextInfo
Close #fnum
My pblnBlaa hold the value True when I assign a Watch to it...But when I look inside my created file...it has been changed into "Waar" (which is Dutch for true)...
Does anyone know why this occurs??
-
Oct 4th, 2002, 09:00 AM
#2
Lively Member
Hey Chrissie. (Excuse my Dutch, VBForummers )
Dit gebeurt omdat je de waarde als "String" op slaat.
De code die je gebruikt:
VB Code:
TextInfo = "pblnBlaa|" & pblnBlaa & vbCrLf
maakt gewoon een tekststring van je variabele. En ja, dat kan dus problemen opleveren in bepaalde taal-versies.
Eén van de de dingen die je kunt doen is het volgende:
VB Code:
TextInfo = "pblnBlaa|" & IIf(pblnBlaa,"1","0") & vbCrLf
Er wordt dan een 1 opgeslagen voor "Waar"/"True", en een 0 voor "OnWaar"/"False".
Teruglezen is dus een kwestie van de 1 weer interpreteren als True en de 0 als False...
Tadaaa
Rob.
Window XP: From the makers of DoubleSpace...
Press ANY key... NO, NO, NO!!! NOT THAT ONE!!!!
-
Oct 4th, 2002, 09:04 AM
#3
Thread Starter
Lively Member
Thanks...
Thanks...is their no possibilty to override language settings with VB? So I don't get any Dutch words returned...
-
Oct 4th, 2002, 09:10 AM
#4
Lively Member
OK... So you want to continue in English? Fine.
You CAN override the language settings, but the easiest solution in this case would be this one:
VB Code:
TextInfo = "pblnBlaa|" & IIf(pblnBlaa,"True","False") & vbCrLf
Thought you might have figured that yourself Same idea...
Rob.
Window XP: From the makers of DoubleSpace...
Press ANY key... NO, NO, NO!!! NOT THAT ONE!!!!
-
Oct 4th, 2002, 09:20 AM
#5
Thread Starter
Lively Member
Thanks...
This for sure is the best way to get it working...It won't have any problems with other languages by now...and doesn't require any extra code for translating 1 back to true...
-
Oct 4th, 2002, 09:26 AM
#6
Lively Member
True, but I consider it to be Dangerous to read a string as "True" and put it in a variable straight away... Have it your way...
Just a small advice (having read your posts): Try saving your data in a BINARY file, using User defined types. This way you WON'T have to parse all data back, and you can be pretty sure Language problems won't arise...
Just my $0.02
Rob.
Window XP: From the makers of DoubleSpace...
Press ANY key... NO, NO, NO!!! NOT THAT ONE!!!!
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
|