home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form fWord
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Word Count"
- ClientHeight = 4215
- ClientLeft = 1410
- ClientTop = 2400
- ClientWidth = 5880
- Height = 4620
- Left = 1350
- LinkTopic = "Form2"
- ScaleHeight = 4215
- ScaleWidth = 5880
- Top = 2055
- Width = 6000
- Begin CommandButton Command1
- BackColor = &H00C0C0C0&
- Caption = "Number Count"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 420
- Index = 2
- Left = 4410
- TabIndex = 4
- Top = 1260
- Width = 1290
- End
- Begin vsFlexString fs
- Left = 4230
- Pattern = "[^ , ]*"
- Text = "VideoSoft FlexString"
- Top = 3135
- End
- Begin CommonDialog CMDialog1
- Left = 3675
- Top = 3165
- End
- Begin CommandButton Command1
- BackColor = &H00C0C0C0&
- Caption = "Letter Count"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 420
- Index = 1
- Left = 4410
- TabIndex = 3
- Top = 765
- Width = 1290
- End
- Begin CommandButton Command1
- BackColor = &H00C0C0C0&
- Caption = "&Get File"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 420
- Index = 9
- Left = 4425
- TabIndex = 0
- Top = 3600
- Width = 1290
- End
- Begin CommandButton Command1
- BackColor = &H00C0C0C0&
- Caption = "Word Count"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 420
- Index = 0
- Left = 4410
- TabIndex = 2
- Top = 270
- Width = 1290
- End
- Begin TextBox Text1
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 3945
- Left = 255
- MultiLine = -1 'True
- TabIndex = 1
- Text = "This is a sample piece of text. Count words, count letters, count numbers."
- Top = 240
- Width = 3945
- End
- Option Explicit
- Sub Command1_Click (Index%)
- fs.Text = Text1
- Select Case Index
- Case 9
- DoGetFile
- Exit Sub
- Case 0: fs.Pattern = "[^ .\t]+"
- Case 1: fs.Pattern = "[a-zA-Z]"
- Case 2: fs.Pattern = "[0-9]+"
- End Select
- Caption = "Word Count - " & fs.MatchCount & " match(es)"
- End Sub
- Sub DoGetFile ()
- On Error Resume Next
- Text1 = ""
- ' Load Dialog
- cmdialog1.Action = 1
- ' Validate Filename and size
- If cmdialog1.Filename = "" Then Exit Sub
- If FileLen(cmdialog1.Filename) > 64000 Then
- MsgBox "File is too large"
- Text1 = "File is too large to be loaded"
- Exit Sub
- End If
- Open cmdialog1.Filename For Input As #1
- Text1 = Input(LOF(1), 1)
- Close #1
- End Sub
-