VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加"
   ClientHeight    =   1830
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   4710
   BeginProperty Font 
      Name            =   "微软雅黑"
      Size            =   10.5
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "Form2.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1830
   ScaleWidth      =   4710
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   120
      TabIndex        =   5
      Top             =   2040
      Visible         =   0   'False
      Width           =   7935
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   495
      Left            =   3360
      TabIndex        =   3
      Top             =   1200
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   495
      Left            =   2145
      TabIndex        =   2
      Top             =   1200
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "新建项目"
      Height          =   975
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4455
      Begin VB.CommandButton Command3 
         Caption         =   "..."
         Height          =   375
         Left            =   3720
         TabIndex        =   4
         Top             =   360
         Width           =   615
      End
      Begin VB.TextBox Text1 
         Height          =   420
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   3495
      End
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub Command1_Click()

Dim Zfu As String
Dim Fg() As String
Dim Lb, Kh, Pp As String
Dim Pd As Boolean
Pd = False
'：/ \ : * " < > | ？
If Text1.text <> "" Then
    '检查文件夹名称是否存在非法字符
    If InStr(Text1.text, """") > 0 Then
        MsgBox "非法名称,数据中不能含有" & """" & "字符!", vbCritical + vbOKOnly, "提示"
        Exit Sub
    End If
    If InStr(Text1.text, "|") > 0 Then
        MsgBox "非法名称,数据中不能含有" & "|" & "字符!", vbCritical + vbOKOnly, "提示"
        Exit Sub
    End If
    Zfu = "/|\|:|*|<|>|？"
    Fg = Split(Zfu, "|")
        For i = 0 To UBound(Fg)
        If InStr(Text1.text, Fg(i)) > 0 Then
            MsgBox "非法名称,数据中不能含有   " & Fg(i) & "   字符!", vbCritical + vbOKOnly, "提示"
            Pd = True
            Exit For
            Exit Sub
        End If
        Next
    '检查文件夹名称完毕

        


    If Pd = False Then
    For i = 1 To Form1.ListView1.ListItems.Count
        If Form1.ListView1.ListItems(i).text = Text1.text Then
            Pd = True
            Exit For
        End If
    Next
    If Pd = False Then
    If Text2.text <> "" Then
    iniPath$ = App.Path & "\Setting\" & Text1.text & ".ini"
    entry = Text2.text: r = WritePrivateProfileString("Setting", "File", entry, iniPath)
    End If
    Form1.ListView1.ListItems.Add 1, , Text1.text, 7, 7
    Form1.ListView1.ListItems(1).Selected = True
    Form1.ListView1.SelectedItem.EnsureVisible
    Form1.ListView2.ColumnHeaders(1).text = "项目"
    Form1.ListView2.ListItems.Clear
    Call Form1.Baocun
    Unload Me
    Call Form1.dianji
    Else
    MsgBox "该文件夹已经存在,请使用其他名称!", vbCritical + vbOKOnly, "提示"
    End If
    End If
End If

End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
Form7.Show 1
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then
Unload Me
End If
End Sub

Private Sub Form_Load()
Me.KeyPreview = True
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Text1.text <> "" Then
        Command1_Click
    End If
End If

End Sub





