📄 制作listbox的索引.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "搜寻List(使用For-Next)"
ClientHeight = 3495
ClientLeft = 2415
ClientTop = 1590
ClientWidth = 3825
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
LinkMode = 1 'Source
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 3495
ScaleWidth = 3825
Begin VB.CommandButton Cancel
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Cancel"
BeginProperty Font
Name = "PMingLiU"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2040
TabIndex = 4
Top = 2880
Width = 1455
End
Begin VB.CommandButton Ok
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Ok"
Default = -1 'True
BeginProperty Font
Name = "PMingLiU"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 3
Top = 2880
Width = 1455
End
Begin VB.ListBox List1
BeginProperty Font
Name = "PMingLiU"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1680
ItemData = "制作ListBox的索引.frx":0000
Left = 270
List = "制作ListBox的索引.frx":0184
TabIndex = 1
Top = 945
Width = 3255
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "PMingLiU"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 0
Top = 480
Width = 3255
End
Begin VB.Label Label1
Caption = "搜寻VB的函数"
BeginProperty Font
Name = "PMingLiU"
Size = 9
Charset = 136
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 2
Top = 120
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Cancel_Click()
End
End Sub
Private Sub Ok_Click()
MsgBox "您选择了" + List1.Text
End Sub
Private Sub Text1_Change()
Dim Search As String, SearchLen As Integer, I As Integer
Search = UCase(Text1.Text)
SearchLen = Len(Search)
If SearchLen Then
For I = 0 To List1.ListCount - 1
If UCase(Left(List1.List(I), SearchLen)) = Search Then
List1.ListIndex = I
Exit For
End If
Next
Else
List1.ListIndex = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -