Thread: game in visual
View Single Post
Old May 23rd, 2006, 9:24 PM   #12
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Please try learning this somewhere else first. Use this more as a guideline. If you just copy and paste this.. you won't learn a thing. Thus, the harder stuff will seem impossible.

Opening a file

   intNewFile = FreeFile
    
   cdl1.Filter = "Text files (*.bat)|*.bat"
   cdl1.ShowOpen
    
   If cdl1.FileName <> "" Then
       Open cdl1.FileName For Input As #intNewFile
       txtFile.Text = ""
        Do While Not EOF(intNewFile)
            Line Input #intNewFile, strTextLine
           txtFile.Text = txtFile.Text + strTextLine & vbCrLf
            blnFile = True
        Loop
        Close #intNewFile
    End If
strFileName = cdl1.FileName
timerCheckFile.Enabled = True
strStats = txtFile.Text


//********

saving a file

intNewFile = FreeFile
    
      ' cdl1.Filter = "Text file (*.txt)|*.txt"
    cdl1.InitDir = "H:\ICS3M"
    cdl1.Filter = "Text file (*.bat)|*.bat"
    cdl1.Flags = cdlOFNOverwritePrompt
    cdl1.ShowSave
    
    If cdl1.FileName <> "" Then
        Open cdl1.FileName For Output As #intNewFile
        Print #intNewFile, txtFile.Text
        Close #intNewFile
    End If
    
    strFileName = cdl1.FileName
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote