⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "列表框"
   ClientHeight    =   4005
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   4005
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.ListBox List1 
      Height          =   1500
      Left            =   480
      TabIndex        =   4
      Top             =   1560
      Width           =   3135
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   480
      TabIndex        =   3
      Text            =   "照猫画虎"
      Top             =   1080
      Width           =   3135
   End
   Begin VB.CommandButton Command3 
      Caption         =   "清除"
      Height          =   495
      Left            =   2400
      TabIndex        =   2
      Top             =   0
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "删除"
      Height          =   495
      Left            =   1200
      TabIndex        =   1
      Top             =   0
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "加入"
      Height          =   495
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   1215
   End
   Begin VB.Label Label3 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "0"
      ForeColor       =   &H80000008&
      Height          =   375
      Left            =   1560
      TabIndex        =   7
      Top             =   3240
      Width           =   1335
   End
   Begin VB.Label Label2 
      Caption         =   "列表项数:"
      Height          =   180
      Left            =   480
      TabIndex        =   6
      Top             =   3240
      Width           =   900
   End
   Begin VB.Label Label1 
      Caption         =   "列表项名称"
      Height          =   255
      Left            =   480
      TabIndex        =   5
      Top             =   720
      Width           =   2055
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim k As String
    k = Text1.Text
    If k <> "" Then
        List1.AddItem k
    End If
End Sub

Private Sub Command2_Click()
    Dim k As Integer
    k = List1.ListIndex
    If k >= 0 Then
        List1.RemoveItem k
    End If
End Sub

Private Sub Command3_Click()
    List1.Clear
End Sub

Private Sub List1_Click()
    Label3.Caption = List1.ListIndex
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -