home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form fFind
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Find & Replace sample"
- ClientHeight = 3195
- ClientLeft = 330
- ClientTop = 1590
- ClientWidth = 5730
- Height = 3600
- Left = 270
- LinkTopic = "Form3"
- ScaleHeight = 3195
- ScaleWidth = 5730
- Top = 1245
- Width = 5850
- Begin vsFlexString fs
- Left = 150
- Pattern = "[^ , ]*"
- Text = "VideoSoft FlexString"
- Top = 1680
- End
- Begin Frame Frame1
- BackColor = &H00C0C0C0&
- Caption = "Find && Replace"
- ForeColor = &H00800000&
- Height = 1035
- Left = 240
- TabIndex = 1
- Top = 2010
- Width = 5205
- Begin TextBox Text1
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Index = 0
- Left = 1620
- TabIndex = 4
- Text = "to {[^ ]+} find"
- Top = 240
- Width = 2100
- End
- Begin TextBox Text1
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Index = 1
- Left = 1620
- TabIndex = 3
- Text = "to find {0}"
- Top = 600
- Width = 2100
- End
- Begin CommandButton Command1
- BackColor = &H00C0C0C0&
- Caption = "Replace All"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Index = 0
- Left = 3855
- TabIndex = 2
- Top = 195
- Width = 1200
- End
- Begin Label Label1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Find What:"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 195
- Index = 0
- Left = 165
- TabIndex = 6
- Top = 345
- Width = 780
- End
- Begin Label Label1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Replace Width:"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 195
- Index = 1
- Left = 105
- TabIndex = 5
- Top = 615
- Width = 1110
- End
- End
- Begin TextBox Text2
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 1680
- Left = 225
- MultiLine = -1 'True
- TabIndex = 0
- Text = "This is an example of how to use the FlexString control to automatically find and replace characters, words, or patterns in a textbox."
- Top = 180
- Width = 5160
- End
- Option Explicit
- Sub Command1_Click (Index%)
- Dim i%
- ' --------------------------------------------------------------------
- ' vsFlexString can automatically find and replace string within strings
- ' --------------------------------------------------------------------
- fs.Pattern = text1(0) ' Find What
- fs.Text = text2 ' Source
- Select Case Index
- Case 0 ' replace All
- If fs.MatchCount > 0 Then
- fs.Replace = text1(1) ' Replace it with
- text2 = fs
- Beep
- Else
- MsgBox "Search text not found!"
- End If
- End Select
- End Sub
-