471,337 Members | 1,169 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

random access files

i'm using "visual basic.net standard ver 2003". i'm running windows xp with
sp2. i'm trying to make a random access file. it will make the file. but the
file will have no data in it. my program is listed below.

Structure jeff
Public id As Integer
Public g1 As Short
Public g2 As Short
Public g3 As Short
Public g4 As Short 'number of games
Public t As Short
Public gt As Integer
Public av As Short
End Structure

Dim fjeff As jeff
Public a1 As String
Public gg1 As Short
Public gg2 As Short
Public gg3 As Short
Public t1 As Short
Public gg4 As Short
Public av1 As Short
Public a As String

a1 = InputBox(a)
gg1 = Val(a1)
a1 = InputBox(a)
gg2 = Val(a1)
a1 = InputBox(a)
gg3 = Val(a1)
t1 = gg1 + gg2 + gg3
gg4 = 3
av1 = t1 / gg4

Try
FileOpen(1, "c:\bowling.txt", OpenMode.Random)
Catch ex As Exception
FileOpen(1, "c:\bowling.txt", OpenMode.Random)
fjeff.id = 1
fjeff.g1 = gg1
fjeff.g2 = gg2
fjeff.g3 = gg3
fjeff.g4 = gg4
fjeff.t = t1
fjeff.gt = t1
fjeff.av = av1
FilePut(1, fjeff, 1)
FileClose(1)
End Try
FileClose(1)

can anyone help? the help file doesn't have the right code for this.

Jul 21 '05 #1
0 929

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Oin Zea | last post: by
9 posts views Thread by greeningster | last post: by
3 posts views Thread by Cybertof | last post: by
1 post views Thread by Patrick | last post: by
3 posts views Thread by Simon | last post: by
13 posts views Thread by Stuart | last post: by
16 posts views Thread by Claudio Grondi | last post: by
39 posts views Thread by Alan Isaac | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.