Problems with structures and strings

J

John

Hi

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

in the structure definition i have:


structure gamedefinitionfile
:
<VBFixedString(20)> Dim namegame As String

:

end structure

form code:

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

Dim gamedef As gamedefinitionfile

FileOpen(fileno, gamedeffile, OpenMode.Random, OpenAccess.ReadWrite,
OpenShare.Shared, reclen)

FileGet(fileno, gamedef, 1)

If gamedef.namegame = "" 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.namegame = "" before the fileget to no effect

i have tried trim(gamedef.namegame) = "" to no effect
 
A

Armin Zingler

John said:
Hi

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

in the structure definition i have:


structure gamedefinitionfile
:
<VBFixedString(20)> Dim namegame As String

:

end structure

form code:

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

Dim gamedef As gamedefinitionfile

FileOpen(fileno, gamedeffile, OpenMode.Random, OpenAccess.ReadWrite,
OpenShare.Shared, reclen)

FileGet(fileno, gamedef, 1)

If gamedef.namegame = "" 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.namegame = "" before the fileget to no
effect

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

What does
gamedef.namegame is Nothing
say?

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


Armin
 
S

SurturZ

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

John

SurturZ said:
I've never used that tag, but perhaps the <VBFixedString(20)> tag is
forcing
your string to 20 characters long?
That is true - i've had to do a work around instead by setting it to
something then testing for that
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top