home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 6 Unleashed…sional Reference Edition) / Visual_Basic_6_Unleashed_Professional_Reference_Edition_Sams_1999.iso / Source / CHAP29 / 309X3210.TXT < prev    next >
Encoding:
Text File  |  1998-05-05  |  1022 b   |  43 lines

  1.  
  2. Private Sub mnuExit_Click()
  3.  
  4. ' Exit the program.
  5. Unload Me
  6. End
  7.  
  8. End Sub
  9.  
  10. Private Sub mnuFileOpenINIFile_Click()
  11.  
  12. Dim intFileNum As Integer
  13. Dim strFileName As String
  14.  
  15. ' Show the Open File dialog box.
  16. dlgGetFilename.FileName = "*.ini"
  17. dlgGetFilename.Filter = "*.ini"
  18. dlgGetFilename.ShowOpen
  19.  
  20. ' If a file was selected, then enable some of the
  21. ' components of the user interface. Then read in
  22. ' and display the contents of the file.
  23. strFileName = dlgGetFilename.FileName
  24. If strFileName <> "" And strFileName <> "*.ini" Then
  25.     txtSectionName.Enabled = True
  26.     txtKeyName.Enabled = True
  27.     txtValue.Enabled = True
  28.     cmdRefresh.Enabled = True
  29.     ' If no file for the selected name exists,
  30.     ' make one.
  31.     If Dir$(strFileName) = "" Then
  32.         intFileNum = FreeFile
  33.         Open strFileName For Output As #intFileNum
  34.         Close #1
  35.     End If
  36.     ' Show the file name in the status area.
  37.     lblStatus = "File " & strFileName & " opened."
  38.     ReadFile
  39.     
  40. End If
  41.  
  42. End Sub
  43.