home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / rename10 / rename.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-07  |  6.9 KB  |  230 lines

  1. VERSION 2.00
  2. Begin Form Rename 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Rename"
  6.    ClientHeight    =   5070
  7.    ClientLeft      =   2040
  8.    ClientTop       =   1380
  9.    ClientWidth     =   8700
  10.    ControlBox      =   0   'False
  11.    Height          =   5475
  12.    KeyPreview      =   -1  'True
  13.    Left            =   1980
  14.    LinkTopic       =   "Form1"
  15.    ScaleHeight     =   5070
  16.    ScaleWidth      =   8700
  17.    Top             =   1035
  18.    Width           =   8820
  19.    Begin CheckBox RenameDir 
  20.       Caption         =   "Rename Directory"
  21.       Height          =   375
  22.       Left            =   2640
  23.       TabIndex        =   4
  24.       Top             =   4200
  25.       Width           =   2175
  26.    End
  27.    Begin SSCommand Command3D1 
  28.       Caption         =   "About"
  29.       Font3D          =   1  'Raised w/light shading
  30.       Height          =   975
  31.       Left            =   6480
  32.       TabIndex        =   8
  33.       Top             =   2280
  34.       Width           =   975
  35.    End
  36.    Begin CommandButton Cancel 
  37.       Cancel          =   -1  'True
  38.       Caption         =   "Quit"
  39.       Height          =   375
  40.       Left            =   7080
  41.       TabIndex        =   7
  42.       Top             =   1800
  43.       Width           =   1215
  44.    End
  45.    Begin CommandButton OK 
  46.       Caption         =   "OK"
  47.       Height          =   375
  48.       Left            =   5640
  49.       TabIndex        =   6
  50.       Top             =   1800
  51.       Width           =   1215
  52.    End
  53.    Begin TextBox Text2 
  54.       Height          =   285
  55.       Left            =   5760
  56.       MaxLength       =   12
  57.       TabIndex        =   5
  58.       Top             =   600
  59.       Width           =   1935
  60.    End
  61.    Begin TextBox Text1 
  62.       Height          =   285
  63.       Left            =   120
  64.       MaxLength       =   12
  65.       TabIndex        =   0
  66.       Top             =   600
  67.       Width           =   1935
  68.    End
  69.    Begin FileListBox File1 
  70.       Height          =   2955
  71.       Hidden          =   -1  'True
  72.       Left            =   120
  73.       ReadOnly        =   0   'False
  74.       System          =   -1  'True
  75.       TabIndex        =   1
  76.       Top             =   960
  77.       Width           =   1935
  78.    End
  79.    Begin DirListBox Dir1 
  80.       Height          =   2505
  81.       Left            =   2280
  82.       TabIndex        =   2
  83.       Top             =   960
  84.       Width           =   2175
  85.    End
  86.    Begin DriveListBox Drive1 
  87.       Height          =   315
  88.       Left            =   120
  89.       TabIndex        =   3
  90.       Top             =   4440
  91.       Width           =   1935
  92.    End
  93.    Begin Label Label5 
  94.       Alignment       =   2  'Center
  95.       BackColor       =   &H00C0C0C0&
  96.       BorderStyle     =   1  'Fixed Single
  97.       Caption         =   "If you find this program useful, please tell me.  You can reach me on America On-Line as:  Majerle09"
  98.       ForeColor       =   &H00FF0000&
  99.       Height          =   1215
  100.       Left            =   5760
  101.       TabIndex        =   14
  102.       Top             =   3480
  103.       Width           =   2295
  104.    End
  105.    Begin Label Label4 
  106.       BackColor       =   &H00FFFFFF&
  107.       Caption         =   "New Name:"
  108.       Height          =   255
  109.       Left            =   5760
  110.       TabIndex        =   13
  111.       Top             =   360
  112.       Width           =   1935
  113.    End
  114.    Begin Label Directory 
  115.       BackColor       =   &H00FFFFFF&
  116.       ForeColor       =   &H00000000&
  117.       Height          =   255
  118.       Left            =   2280
  119.       TabIndex        =   12
  120.       Top             =   600
  121.       Width           =   2775
  122.    End
  123.    Begin Label Label3 
  124.       BackColor       =   &H00FFFFFF&
  125.       Caption         =   "Drive:"
  126.       Height          =   255
  127.       Left            =   120
  128.       TabIndex        =   11
  129.       Top             =   4200
  130.       Width           =   1215
  131.    End
  132.    Begin Label Label2 
  133.       BackColor       =   &H00FFFFFF&
  134.       Caption         =   "Directory:"
  135.       Height          =   255
  136.       Left            =   2280
  137.       TabIndex        =   10
  138.       Top             =   360
  139.       Width           =   1575
  140.    End
  141.    Begin Label Label1 
  142.       BackColor       =   &H00FFFFFF&
  143.       Caption         =   "File Name:"
  144.       Height          =   255
  145.       Left            =   120
  146.       TabIndex        =   9
  147.       Top             =   360
  148.       Width           =   1095
  149.    End
  150. Sub cancel_Click ()
  151.     If Drive1.Drive <> App.Path Then ChDrive App.Path
  152.     Call WriteProfileString("Rename", "RenameDirectory", (RenameDir.Value))
  153.     Call WriteProfileString("Rename", "Version", "1.0")
  154.     Unload Me
  155.     End
  156. End Sub
  157. Sub Command1_Click ()
  158.     About.Show 1
  159. End Sub
  160. Sub Command3D1_Click ()
  161.     About.Show 1
  162. End Sub
  163. Sub Dir1_Change ()
  164.     ChDir Dir1.Path
  165.     File1.Path = Dir1.Path
  166.     Directory.Caption = Dir1.Path
  167. End Sub
  168. Sub Drive1_Change ()
  169.     ChDrive Drive1.Drive
  170.     Dir1.Path = Drive1.Drive
  171. End Sub
  172. Sub File1_Click ()
  173.     Text1.Text = File1.FileName
  174.     Text1.Text = LCase(Text1.Text)
  175. End Sub
  176. Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
  177.     If KeyCode = KEY_F1 Then About.Show 1
  178. End Sub
  179. Sub Form_Load ()
  180.     Directory.Caption = Dir1.Path
  181.     RenameDir.Value = GetProfileInt%("Rename", "RenameDirectory", 0)
  182. End Sub
  183. Sub OK_Click ()
  184.     If Text1.Text = "" Then GoTo Nope
  185.     If Text2.Text <> "" Then GoTo OK Else GoTo NO
  186.     Text2.Text = LCase(Text2.Text)
  187.     If Text1.Text = Text2.Text Then MsgBox "File already exists.  Cannot rename.", 0 + 16, "File Already Exists": GoTo End1
  188.     If File1.FileName = Text2.Text Then MsgBox "File already exists.  Cannot rename.", 0 + 16, "File Already Exists": GoTo End1
  189.     On Error GoTo FileHelper
  190. Start:
  191.     Name Text1.Text As Text2.Text
  192.     MsgBox UCase(Text1.Text) + " was renamed " + UCase(Text2.Text), 0 + 64, "Rename"
  193.     GoTo End1
  194. FileHelper:
  195.     MsgBox "There was an error renaming the file.", 0 + 16, "ERROR"
  196.     GoTo Ends
  197. Nope:
  198.     MsgBox "There was no file selected.", 0 + 16, "ERROR"
  199.     GoTo End1
  200.     MsgBox "There was no new name entered for " + UCase(Text1.Text), 0 + 16, "ERROR"
  201.     GoTo End1
  202. Ends:
  203.     If Drive1.Drive <> App.Path Then ChDrive App.Path
  204.     Call WriteProfileString("Rename", "RenameDirectory", (RenameDir.Value))
  205.     Call WriteProfileString("Rename", "Version", "1.0")
  206.     Unload Me
  207.     End
  208. End1:
  209.     ChDir Dir1.Path
  210.     File1.Path = Dir1.Path
  211.     Directory.Caption = Dir1.Path
  212.     Text1.Text = ""
  213.     Text2.Text = ""
  214. End Sub
  215. Sub ShowHidden_Click (Value As Integer)
  216. End Sub
  217. Sub ShowSystem_Click (Value As Integer)
  218. End Sub
  219. Sub Text1_Change ()
  220.     If Text1.Text = File1.FileName Then Text1.Text = File1.FileName
  221.     If RenameDir.Value = 1 Then Text1.MaxLength = 0
  222.     If RenameDir.Value = 0 Then Text1.MaxLength = 12
  223. End Sub
  224. Sub Text2_Change ()
  225.     If RenameDir.Value = 1 Then Text2.MaxLength = 0
  226.     If RenameDir.Value = 0 Then Text2.MaxLength = 12
  227. End Sub
  228. Sub Text3_Change ()
  229. End Sub
  230.