【VB开源代码栏目提醒】:网学会员在VB开源代码频道为大家收集整理了Ex8_3.frm提供大家参考,希望对大家有所帮助!
VERSION 5.00
Begin VB.Form Ex8_3
Caption = "查找"
ClientHeight = 2025
ClientLeft = 60
ClientTop = 450
ClientWidth = 4620
LinkTopic = "Form1"
ScaleHeight = 2025
ScaleWidth = 4620
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 1095
Left = 240
MultiLine = -1 'True
TabIndex = 0
Top = 240
Width = 4215
End
End
Attribute VB_Name = "Ex8_3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Text1.Text = "Two of the peak human experiences"
Text1.Text = Text1.Text & " are good food and classical music."
End Sub
Private Sub Form_Click()
Dim Search, Where ' 声明变量。
' 获取需要查找的字符串。
Search = InputBox("Enter text to be found:")
Where = InStr(Text1.Text, Search) ' 在文本中查找字符串。
If Where Then ' 如果找到,
Text1.SelStart = Where - 1 ' 设置选定的起始位置并
Text1.SelLength = Len(Search) ' 设置选定的长度。
Else
MsgBox "String not found." ' 给出通知。
End If
End Sub
上一篇:
Ex8_2.frm
下一篇:
科研管理杂志简介