home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form fWalk
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Walk through Strings"
- ClientHeight = 3630
- ClientLeft = 855
- ClientTop = 975
- ClientWidth = 5805
- Height = 4035
- Left = 795
- LinkTopic = "Form1"
- ScaleHeight = 3630
- ScaleWidth = 5805
- Top = 630
- Width = 5925
- Begin vsFlexString fs
- Left = 330
- Pattern = "[^ ,\t.]*"
- Text = "VideoSoft FlexString"
- Top = 2820
- End
- Begin CommandButton Command1
- BackColor = &H00000000&
- Caption = "&Go To Word #..."
- Default = -1 'True
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 2685
- TabIndex = 0
- Top = 2595
- Width = 1470
- End
- Begin CommandButton Command3
- BackColor = &H00000000&
- Caption = "Next Word"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 405
- Index = 1
- Left = 1170
- TabIndex = 6
- Top = 2595
- Width = 1380
- End
- Begin CommandButton Command3
- BackColor = &H00000000&
- Caption = "Previous Word"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 405
- Index = 0
- Left = 1170
- TabIndex = 5
- Top = 2970
- Width = 1380
- End
- Begin TextBox Text3
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Left = 3750
- TabIndex = 4
- Tag = "&Match#"
- Text = "0"
- Top = 930
- Width = 690
- End
- Begin TextBox Text2
- BackColor = &H00C0C0C0&
- Enabled = 0 'False
- Height = 300
- Left = 3735
- TabIndex = 3
- Tag = "&Pattern"
- Text = "[^ .,\t]*"
- Top = 480
- Width = 1740
- End
- Begin TextBox Text1
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 13.5
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 2430
- HideSelection = 0 'False
- Left = 225
- MultiLine = -1 'True
- TabIndex = 2
- Tag = "&Text"
- Text = "This is a long string that will be used as a target for the FlexString control."
- Top = 105
- Width = 2340
- End
- Begin TextBox Text4
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 285
- Left = 3750
- TabIndex = 1
- Tag = "&Match"
- Top = 1425
- Width = 1245
- End
- Begin Label Label1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Word text:"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 195
- Index = 1
- Left = 2910
- TabIndex = 8
- Top = 1455
- Width = 735
- End
- Begin Label Label1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Word #"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 195
- Index = 0
- Left = 3015
- TabIndex = 7
- Top = 945
- Width = 540
- End
- Option Explicit
- Sub Command1_Click ()
- Dim Answer
- Answer = Val(InputBox("To which word number would you like to go", "VideoSoft", text3)) ' Get user input.
- Loop Until Answer >= 0 And Answer <= fs.MatchCount - 1
- text3 = Str$(Answer)
- DoWalk
- End Sub
- Sub Command3_Click (Index%)
- Select Case Index
- Case 0 ' Previous word
- If Val(text3) = 0 Then
- text3 = 0
- Beep
- Else
- text3 = Format(Val(text3) - 1)
- End If
-
- Case 1 ' Next word
- If Val(text3) = fs.MatchCount - 1 Then
- text3 = fs.MatchCount - 1
- Beep
- Else
- text3 = Format(Val(text3) + 1)
- End If
- End Select
- DoWalk
- End Sub
- Sub DoWalk ()
- ' set matcher parameters
- fs = text1
- fs.Pattern = text2
- fs.MatchIndex = Val(text3)
- ' show number of matches
- 'label1 = fs.MatchCount + " Matches found"
- ' show match
- If fs.MatchStart >= 0 Then
- text1.SelStart = fs.MatchStart
- text1.SelLength = fs.MatchLength
- text4 = fs.MatchString
- Else
- text1.SelStart = 0
- text1.SelLength = 0
- text4 = "NOT FOUND"
- End If
- End Sub
- Sub Form_Load ()
- fs = text1
- fs.Pattern = text2
- fs.MatchIndex = Val(text3)
- DoWalk
- End Sub
-