Results 1 to 6 of 6

Thread: Waar/Onwaar instead of True/False when writing to file...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96

    Waar/Onwaar instead of True/False when writing to file...

    I have a real strange language problem...

    VB Code:
    1. TextInfo = "pblnBlaa|" & pblnBlaa & vbCrLf
    2.         Open bla.txt For Output As #fnum
    3.         Print #fnum, TextInfo
    4.         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??

  2. #2
    Lively Member RobIII's Avatar
    Join Date
    Jul 2002
    Location
    Netherlands
    Posts
    112
    Hey Chrissie. (Excuse my Dutch, VBForummers )

    Dit gebeurt omdat je de waarde als "String" op slaat.
    De code die je gebruikt:
    VB Code:
    1. 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:
    1. 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!!!!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96

    Thanks...

    Thanks...is their no possibilty to override language settings with VB? So I don't get any Dutch words returned...

  4. #4
    Lively Member RobIII's Avatar
    Join Date
    Jul 2002
    Location
    Netherlands
    Posts
    112
    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:
    1. 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!!!!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96

    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...

  6. #6
    Lively Member RobIII's Avatar
    Join Date
    Jul 2002
    Location
    Netherlands
    Posts
    112
    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
  •  



Click Here to Expand Forum to Full Width