Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21100

Record length problem

$
0
0
Record is defined as:

Type LocRecord '244 bytes
LocNbr As Integer
LocName As String * 30
LocDesc As String * 200
LocDir(6) As Boolean
End Type
Public rndLocation As LocRecord

File is opened with:

Open "C:\Users\Bart\Text Adventures\" & gbl.strGameName & "Loc" For Random As #intFileNumber Len = 244
So far ok, I now have a open file without any records

Enter some data through a forms various controls

When I try to save it using

gbl.RecNbr = Val(txtLocNbr.Text)
With rndLocation
.LocNbr = gbl.RecNbr
.LocName = txtLocName.Text
.LocDesc = txtLocDesc.Text
.LocDir(1) = chkDir(1).Value
.LocDir(2) = chkDir(2).Value
.LocDir(3) = chkDir(3).Value
.LocDir(4) = chkDir(4).Value
.LocDir(5) = chkDir(5).Value
.LocDir(6) = chkDir(6).Value
End With
Put #intFileNumber, gbl.RecNbr, rndLocation

Get a record length error.
?Len(rndLocation) in immediate window gives me 246!?

any help is appreciated or if I have left something out, ask and I'll try to provide it.

Viewing all articles
Browse latest Browse all 21100

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>