Problems with structures and strings

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Problems with structures and strings

    Hi

    I am having a strange problem with a structure and fixed string:

    in the structure definition i have:


    structure gamedefinitionf ile
    :
    <VBFixedString( 20)Dim namegame As String

    :

    end structure

    form code:

    'in my code, i open the file (which may not exist)

    Dim gamedef As gamedefinitionf ile

    FileOpen(fileno , gamedeffile, OpenMode.Random , OpenAccess.Read Write,
    OpenShare.Share d, reclen)

    FileGet(fileno, gamedef, 1)

    If gamedef.namegam e = "" Then

    ' problem is this never seems to get executed, ie it is never recognised as
    null. But when i use a stop statement to check the value it shows as ""

    end if

    i have tried setting gamedef.namegam e = "" before the fileget to no effect

    i have tried trim(gamedef.na megame) = "" to no effect



  • Armin Zingler

    #2
    Re: Problems with structures and strings

    "John" <no-email-supplied@nothin g.comschrieb
    Hi
    >
    I am having a strange problem with a structure and fixed string:
    >
    in the structure definition i have:
    >
    >
    structure gamedefinitionf ile
    :
    <VBFixedString( 20)Dim namegame As String
    >
    :
    >
    end structure
    >
    form code:
    >
    'in my code, i open the file (which may not exist)
    >
    Dim gamedef As gamedefinitionf ile
    >
    FileOpen(fileno , gamedeffile, OpenMode.Random , OpenAccess.Read Write,
    OpenShare.Share d, reclen)
    >
    FileGet(fileno, gamedef, 1)
    >
    If gamedef.namegam e = "" Then
    >
    ' problem is this never seems to get executed, ie it is never
    recognised as
    null. But when i use a stop statement to check the value it shows as

    Can never be null. Maybe Nothing. Null is something else dealing with
    database (DBNull.Value)
    ""
    >
    end if
    >
    i have tried setting gamedef.namegam e = "" before the fileget to no
    effect
    >
    i have tried trim(gamedef.na megame) = "" to no effect
    What does
    gamedef.namegam e is Nothing
    say?

    If it returns False, what does
    gamedef.namegam e.length
    return?


    Armin

    Comment

    • =?Utf-8?B?U3VydHVyWg==?=

      #3
      Re: Problems with structures and strings

      I've never used that tag, but perhaps the <VBFixedString( 20)tag is forcing
      your string to 20 characters long?

      --
      David Streeter
      Synchrotech Software
      Sydney Australia


      "Armin Zingler" wrote:
      "John" <no-email-supplied@nothin g.comschrieb
      Hi

      I am having a strange problem with a structure and fixed string:

      in the structure definition i have:


      structure gamedefinitionf ile
      :
      <VBFixedString( 20)Dim namegame As String

      :

      end structure

      form code:

      'in my code, i open the file (which may not exist)

      Dim gamedef As gamedefinitionf ile

      FileOpen(fileno , gamedeffile, OpenMode.Random , OpenAccess.Read Write,
      OpenShare.Share d, reclen)

      FileGet(fileno, gamedef, 1)

      If gamedef.namegam e = "" Then

      ' problem is this never seems to get executed, ie it is never
      recognised as
      null. But when i use a stop statement to check the value it shows as
      >
      >
      Can never be null. Maybe Nothing. Null is something else dealing with
      database (DBNull.Value)
      >
      ""

      end if

      i have tried setting gamedef.namegam e = "" before the fileget to no
      effect

      i have tried trim(gamedef.na megame) = "" to no effect
      >
      What does
      gamedef.namegam e is Nothing
      say?
      >
      If it returns False, what does
      gamedef.namegam e.length
      return?
      >
      >
      Armin
      >
      >

      Comment

      • John

        #4
        Re: Problems with structures and strings


        "SurturZ" <surturz@newsgr oup.nospamwrote in message
        news:4659E29D-839D-420B-B378-4ED260F63231@mi crosoft.com...
        I've never used that tag, but perhaps the <VBFixedString( 20)tag is
        forcing
        your string to 20 characters long?
        >
        --
        David Streeter
        Synchrotech Software
        Sydney Australia
        >
        >
        "Armin Zingler" wrote:
        >
        >"John" <no-email-supplied@nothin g.comschrieb
        Hi
        >
        I am having a strange problem with a structure and fixed string:
        >
        in the structure definition i have:
        >
        >
        structure gamedefinitionf ile
        :
        <VBFixedString( 20)Dim namegame As String
        >
        :
        >
        end structure
        >
        form code:
        >
        'in my code, i open the file (which may not exist)
        >
        Dim gamedef As gamedefinitionf ile
        >
        FileOpen(fileno , gamedeffile, OpenMode.Random , OpenAccess.Read Write,
        OpenShare.Share d, reclen)
        >
        FileGet(fileno, gamedef, 1)
        >
        If gamedef.namegam e = "" Then
        >
        ' problem is this never seems to get executed, ie it is never
        recognised as
        null. But when i use a stop statement to check the value it shows as
        >>
        >>
        >Can never be null. Maybe Nothing. Null is something else dealing with
        >database (DBNull.Value)
        >>
        ""
        >
        end if
        >
        i have tried setting gamedef.namegam e = "" before the fileget to no
        effect
        >
        i have tried trim(gamedef.na megame) = "" to no effect
        >>
        >What does
        > gamedef.namegam e is Nothing
        >say?
        >>
        >If it returns False, what does
        > gamedef.namegam e.length
        >return?
        >>
        >>
        >Armin
        >>
        >>
        That is true - i've had to do a work around instead by setting it to
        something then testing for that

        Comment

        Working...