VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This program creates txtfiles saves information about your game at runtime in a file, so you can ma

by Mike U. (5 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 22nd February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This program creates txtfiles saves information about your game at runtime in a file, so you can make longer games. The code also reads the

Rate This program creates txtfiles saves information about your game at runtime in a file, so you can ma



'Also see my installation program.

'*******************Write Info**********************
    Static y As String
    Static x As Integer
    y = Text1.Text
    x = Combo1.Text
    Dim fso As New FileSystemObject, txtfile, fil1, fil2
    Set txtfile = fso.CreateTextFile("c:\Game\Save\Level1.txt", True)
    Set fil1 = fso.GetFile("c:\Game\Data\info.txt")
    Set fil2 = fso.GetFile("c:\Game\Data\info1.txt")
    Set ts = fil1.OpenAsTextStream(ForWriting)
    Set th = fil2.OpenAsTextStream(ForWriting)
    ts.Write y
    ts.Close
    th.Write x
    th.Close
    txtfile.Write ("The password is Cool.")
    txtfile.Close
'****************Read info****************
    Dim fso As New FileSystemObject, txtfile, fil2, fil1 As File, ts As TextStream
'Make sure to check microsoft scripting runtime under references under project
    Set fil1 = fso.GetFile("c:\game\data\info.txt")
    Set ts = fil1.OpenAsTextStream(ForReading)
    s = ts.ReadLine
    Combo1.Text = s
    ts.Close
    Set fil2 = fso.GetFile("c:\game\data\info1.txt")
    Set th = fil2.OpenAsTextStream(ForReading)
    h = th.ReadLine
    Text1.Text = h
    th.Close
    End Sub

Download this snippet    Add to My Saved Code

This program creates txtfiles saves information about your game at runtime in a file, so you can ma Comments

No comments have been posted about This program creates txtfiles saves information about your game at runtime in a file, so you can ma. Why not be the first to post a comment about This program creates txtfiles saves information about your game at runtime in a file, so you can ma.

Post your comment

Subject:
Message:
0/1000 characters