home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / DM_AppPath2133241152008.psc / DmAppPaths / frm / frmAdd.frm next >
Text File  |  2008-11-05  |  5KB  |  169 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmAdd 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    ClientHeight    =   2550
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   5370
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   2550
  13.    ScaleWidth      =   5370
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   1  'CenterOwner
  16.    Begin VB.CommandButton cmdOK 
  17.       Default         =   -1  'True
  18.       Enabled         =   0   'False
  19.       Height          =   350
  20.       Left            =   3075
  21.       TabIndex        =   4
  22.       Top             =   1995
  23.       Width           =   1012
  24.    End
  25.    Begin VB.CommandButton cmdcancel 
  26.       Caption         =   "Cancel"
  27.       Height          =   350
  28.       Left            =   4185
  29.       TabIndex        =   5
  30.       Top             =   1995
  31.       Width           =   1012
  32.    End
  33.    Begin VB.CommandButton cmdOpen 
  34.       Caption         =   ". . . ."
  35.       Height          =   345
  36.       Left            =   4275
  37.       TabIndex        =   3
  38.       ToolTipText     =   "Open"
  39.       Top             =   1305
  40.       Width           =   585
  41.    End
  42.    Begin VB.TextBox txtExePath 
  43.       Height          =   350
  44.       Left            =   285
  45.       Locked          =   -1  'True
  46.       TabIndex        =   2
  47.       Top             =   1305
  48.       Width           =   3945
  49.    End
  50.    Begin MSComDlg.CommonDialog CD1 
  51.       Left            =   4740
  52.       Top             =   795
  53.       _ExtentX        =   847
  54.       _ExtentY        =   847
  55.       _Version        =   393216
  56.    End
  57.    Begin VB.TextBox txtName 
  58.       Height          =   350
  59.       Left            =   285
  60.       TabIndex        =   1
  61.       Top             =   570
  62.       Width           =   3945
  63.    End
  64.    Begin VB.Image Image1 
  65.       Height          =   480
  66.       Left            =   4590
  67.       Picture         =   "frmAdd.frx":0000
  68.       Top             =   75
  69.       Width           =   480
  70.    End
  71.    Begin VB.Label lblPath 
  72.       AutoSize        =   -1  'True
  73.       BackStyle       =   0  'Transparent
  74.       Caption         =   "Program Path"
  75.       Height          =   195
  76.       Left            =   285
  77.       TabIndex        =   6
  78.       Top             =   1065
  79.       Width           =   960
  80.    End
  81.    Begin VB.Label lblName 
  82.       AutoSize        =   -1  'True
  83.       BackStyle       =   0  'Transparent
  84.       Caption         =   "Program Name:"
  85.       Height          =   195
  86.       Left            =   285
  87.       TabIndex        =   0
  88.       Top             =   285
  89.       Width           =   1095
  90.    End
  91. End
  92. Attribute VB_Name = "frmAdd"
  93. Attribute VB_GlobalNameSpace = False
  94. Attribute VB_Creatable = False
  95. Attribute VB_PredeclaredId = True
  96. Attribute VB_Exposed = False
  97. Option Explicit
  98.  
  99. Private Sub cmdcancel_Click()
  100.     ButtonPress = vbCancel
  101.     Unload frmAdd
  102. End Sub
  103.  
  104. Private Sub cmdOK_Click()
  105.     ExeName = txtName.Text
  106.     ExePath = txtExePath.Text
  107.     ButtonPress = vbOK
  108.     Unload frmAdd
  109. End Sub
  110.  
  111. Private Sub cmdOpen_Click()
  112. On Error GoTo OpenErr:
  113.     
  114.     With CD1
  115.         .CancelError = True
  116.         .DialogTitle = "Open"
  117.         .Filter = "Program Files(*.exe)|*.exe|"
  118.         'Update Init Path, if file name is present
  119.         If Len(txtExePath.Text) > 0 Then
  120.             .InitDir = GetPathFormFile(txtExePath.Text)
  121.         End If
  122.         .ShowOpen
  123.         'Update text box with exe filename
  124.         txtExePath.Text = .FileName
  125.         txtExePath.ToolTipText = .FileName
  126.     End With
  127.     
  128.     Exit Sub
  129. OpenErr:
  130.     If (Err.Number = cdlCancel) Then
  131.         Err.Clear
  132.     End If
  133. End Sub
  134.  
  135. Private Sub Form_Load()
  136.     Set frmAdd.Icon = Nothing
  137.     
  138.     If (EditOp = 0) Then
  139.         frmAdd.Caption = "Add"
  140.         cmdOK.Caption = "OK"
  141.     End If
  142.     
  143.     If (EditOp = 1) Then
  144.         frmAdd.Caption = "Edit"
  145.         cmdOK.Caption = "Update"
  146.         txtName.Text = ExeName
  147.         txtExePath.Text = ExePath
  148.         txtExePath.ToolTipText = txtExePath.Text
  149.     End If
  150.     
  151. End Sub
  152.  
  153. Private Sub txtExePath_Change()
  154.     Call txtName_Change
  155. End Sub
  156.  
  157. Private Sub txtName_Change()
  158.     cmdOK.Enabled = Len(txtName.Text) > 0 And Len(txtExePath.Text) > 0
  159. End Sub
  160.  
  161. Private Sub txtName_KeyPress(KeyAscii As Integer)
  162.     If (KeyAscii = 46) Then
  163.         KeyAscii = 0
  164.     End If
  165.     If (KeyAscii = 13) Then
  166.         KeyAscii = 0
  167.     End If
  168. End Sub
  169.