VERSION 5.00
Begin VB.Form lstBooks 
   Caption         =   "Form1"
   ClientHeight    =   2835
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3945
   LinkTopic       =   "Form1"
   ScaleHeight     =   2835
   ScaleWidth      =   3945
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2520
      TabIndex        =   5
      Text            =   "Text1"
      Top             =   120
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "修改确定"
      Height          =   375
      Left            =   2640
      TabIndex        =   4
      Top             =   2160
      Width           =   975
   End
   Begin VB.CommandButton Command3 
      Caption         =   "修改"
      Height          =   375
      Left            =   2640
      TabIndex        =   3
      Top             =   1680
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "删除"
      Height          =   375
      Left            =   2640
      TabIndex        =   2
      Top             =   1200
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   375
      Left            =   2640
      TabIndex        =   1
      Top             =   720
      Width           =   975
   End
   Begin VB.ListBox List1 
      Height          =   2400
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   1815
   End
End
Attribute VB_Name = "lstBooks"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

  Sub Form_Load()
    List1.AddItem "计算机文化基础"
    List1.AddItem "VB 6.0程序设计教程"
    List1.AddItem "操作系统"
    List1.AddItem "多媒体技术"
    List1.AddItem "网络技术基础"
Command4.Enabled = False
End Sub
Sub Command1_Click()
    List1.AddItem Text1
    Text1 = ""
End Sub
Sub Command2_Click()
    List1.RemoveItem List1.ListIndex
End Sub
Sub Command3_Click()
    Text1 = List1.Text                  ' 将选定的选项送文本框供修改
    Text1.SetFocus
    Command1.Enabled = False
    Command2.Enabled = False
    Command3.Enabled = False
    Command4.Enabled = True
End Sub
Sub Command4_Click()
    ' 将修改后的选项送回列表框，替换原项目，实现修改
    List1.List(List1.ListIndex) = Text1
    Command4.Enabled = False
    Command1.Enabled = True
    Command2.Enabled = True
    Command3.Enabled = True
    Text1 = ""
End Sub

    Sub cmdModify_Ok_Click()
        '将修改后的项目送回列表框，替换原项目，实现修改
        lstBooks.List(lstBooks.ListIndex) = txtItem
        cmdModify_Ok.Enabled = False
        cmdAdd.Enabled = True
        cmdDelete.Enabled = True
        cmdModify.Enabled = True
        txtItem = ""
    End Sub

