home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Teco's ""Fun With Text"" Examples"
- ClientHeight = 6390
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 7665
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 6390
- ScaleWidth = 7665
- StartUpPosition = 2 'CenterScreen
- Begin VB.Frame Frame13
- Height = 975
- Left = 0
- TabIndex = 41
- Top = 5400
- Width = 7575
- Begin VB.Label Label15
- Alignment = 2 'Center
- BackStyle = 0 'Transparent
- Caption = "FOR ALL YOUR VB NEEDS: http://www.planet-source-code.com/vb/"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 120
- TabIndex = 44
- Top = 720
- Width = 7335
- End
- Begin VB.Label Label14
- Alignment = 2 'Center
- Caption = "Special Thanks also goes out to ANTI for their Repetitions Counter Coding Example"
- Height = 255
- Left = 120
- TabIndex = 43
- Top = 480
- Width = 7335
- End
- Begin VB.Label Label13
- Alignment = 2 'Center
- Caption = "Special Thanks goes out to JASON MONROE for his Encrypt/Decrypt Coding Example."
- Height = 255
- Left = 120
- TabIndex = 42
- Top = 240
- Width = 7335
- End
- End
- Begin VB.Frame Frame11
- Caption = "Example #6"
- Height = 1695
- Left = 3960
- TabIndex = 34
- Top = 3600
- Width = 3615
- Begin VB.CommandButton Command11
- Caption = "Counter Letter ""E"""
- Height = 375
- Left = 1920
- TabIndex = 40
- Top = 1200
- Width = 1575
- End
- Begin VB.CommandButton Command10
- Caption = "Count Letter ""O"""
- Height = 375
- Left = 120
- TabIndex = 39
- Top = 1200
- Width = 1815
- End
- Begin VB.Frame Frame12
- Height = 615
- Left = 120
- TabIndex = 36
- Top = 480
- Width = 3375
- Begin VB.TextBox Text6
- Height = 285
- Left = 720
- TabIndex = 38
- Text = "Moo Is Definately For You Too"
- Top = 240
- Width = 2535
- End
- Begin VB.Label Label12
- Caption = "String:"
- Height = 255
- Left = 120
- TabIndex = 37
- Top = 240
- Width = 855
- End
- End
- Begin VB.Label Label11
- Caption = "Repetitions (
- 1999 Anti)"
- Height = 255
- Left = 120
- TabIndex = 35
- Top = 240
- Width = 3375
- End
- End
- Begin VB.Frame Frame9
- Caption = "Example #5"
- Height = 1695
- Left = 0
- TabIndex = 27
- Top = 3600
- Width = 3855
- Begin VB.CommandButton Command9
- Caption = "Encrypt"
- Height = 375
- Left = 2040
- TabIndex = 33
- Top = 1200
- Width = 1695
- End
- Begin VB.CommandButton Command8
- Caption = "Decrypt"
- Height = 375
- Left = 120
- TabIndex = 32
- Top = 1200
- Width = 1935
- End
- Begin VB.Frame Frame10
- Height = 615
- Left = 120
- TabIndex = 29
- Top = 480
- Width = 3615
- Begin VB.TextBox Text5
- Height = 285
- Left = 720
- TabIndex = 31
- Text = "Technical Communications"
- Top = 240
- Width = 2775
- End
- Begin VB.Label Label10
- Caption = "String:"
- Height = 255
- Left = 120
- TabIndex = 30
- Top = 240
- Width = 855
- End
- End
- Begin VB.Label Label9
- Caption = "Data Encryption (
- 1999 Jason Monroe)"
- Height = 255
- Left = 120
- TabIndex = 28
- Top = 240
- Width = 3615
- End
- End
- Begin VB.Frame Frame7
- Caption = "Example #4"
- Height = 1695
- Left = 3960
- TabIndex = 20
- Top = 1800
- Width = 3615
- Begin VB.CommandButton Command7
- Caption = "Trim Trailing"
- Height = 375
- Left = 1920
- TabIndex = 26
- Top = 1200
- Width = 1575
- End
- Begin VB.CommandButton Command6
- Caption = "Trim Leading"
- Height = 375
- Left = 120
- TabIndex = 25
- Top = 1200
- Width = 1815
- End
- Begin VB.Frame Frame8
- Height = 615
- Left = 120
- TabIndex = 22
- Top = 480
- Width = 3375
- Begin VB.TextBox Text4
- Height = 285
- Left = 720
- TabIndex = 24
- Text = " My The Sky Is Blue To You? "
- Top = 240
- Width = 2535
- End
- Begin VB.Label Label8
- Caption = "String:"
- Height = 255
- Left = 120
- TabIndex = 23
- Top = 240
- Width = 735
- End
- End
- Begin VB.Label Label7
- Caption = "Removing Trailing and Leading Spaces"
- Height = 255
- Left = 120
- TabIndex = 21
- Top = 240
- Width = 3255
- End
- End
- Begin VB.Frame Frame5
- Caption = "Example #3"
- Height = 1695
- Left = 0
- TabIndex = 14
- Top = 1800
- Width = 3855
- Begin VB.CommandButton Command5
- Caption = "Reverse String"
- Height = 375
- Left = 120
- TabIndex = 19
- Top = 1200
- Width = 3615
- End
- Begin VB.Frame Frame6
- Height = 615
- Left = 120
- TabIndex = 16
- Top = 480
- Width = 3615
- Begin VB.TextBox Text3
- Height = 285
- Left = 720
- TabIndex = 18
- Text = "Hippy Cowboys From Hell"
- Top = 240
- Width = 2775
- End
- Begin VB.Label Label6
- Caption = "String:"
- Height = 255
- Left = 120
- TabIndex = 17
- Top = 240
- Width = 615
- End
- End
- Begin VB.Label Label5
- Caption = "Reversing Strings"
- Height = 255
- Left = 120
- TabIndex = 15
- Top = 240
- Width = 2655
- End
- End
- Begin VB.Frame Frame3
- Caption = "Example #2"
- Height = 1695
- Left = 3960
- TabIndex = 7
- Top = 0
- Width = 3615
- Begin VB.CommandButton Command4
- Caption = "lowercase"
- Height = 375
- Left = 1920
- TabIndex = 13
- Top = 1200
- Width = 1575
- End
- Begin VB.CommandButton Command3
- Caption = "UPPERCASE"
- Height = 375
- Left = 240
- TabIndex = 12
- Top = 1200
- Width = 1695
- End
- Begin VB.Frame Frame4
- Height = 615
- Left = 120
- TabIndex = 9
- Top = 480
- Width = 3375
- Begin VB.TextBox Text2
- Height = 285
- Left = 720
- TabIndex = 11
- Text = "Marmalade Milkmaid"
- Top = 240
- Width = 2535
- End
- Begin VB.Label Label4
- Caption = "String:"
- Height = 255
- Left = 120
- TabIndex = 10
- Top = 240
- Width = 735
- End
- End
- Begin VB.Label Label3
- Caption = "Uppercase and Lowercase"
- Height = 255
- Left = 120
- TabIndex = 8
- Top = 240
- Width = 3135
- End
- End
- Begin VB.Frame Frame1
- Caption = "Example #1"
- Height = 1695
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 3855
- Begin VB.CommandButton Command2
- Caption = "Replace ""A"" To ""B"""
- Height = 375
- Left = 2040
- TabIndex = 6
- Top = 1200
- Width = 1695
- End
- Begin VB.CommandButton Command1
- Caption = "Replace Spaces To ""+"""
- Height = 375
- Left = 120
- TabIndex = 5
- Top = 1200
- Width = 1935
- End
- Begin VB.Frame Frame2
- Height = 615
- Left = 120
- TabIndex = 2
- Top = 480
- Width = 3615
- Begin VB.TextBox Text1
- Height = 285
- Left = 720
- TabIndex = 4
- Text = "Ernie Earnsteain And I"
- Top = 240
- Width = 2775
- End
- Begin VB.Label Label2
- Caption = "String:"
- Height = 255
- Left = 120
- TabIndex = 3
- Top = 240
- Width = 855
- End
- End
- Begin VB.Label Label1
- Caption = "Replacing Characters"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 240
- Width = 3615
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- 'Replace Spaces with Plus Signs In String Text
- '---------------------------------------------
- Dim i As Integer 'counting variable
- Dim temp As String 'text variable
- Let i = 1
- Let temp = Text1.Text
- Let Text1.Text = ""
- While i <= Len(temp)
- 'while the counter is less than the length of string
- If Mid(temp, i, 1) = " " Then
- 'if the character is blank then
- Mid(temp, i, 1) = "+"
- 'remove blank, add Null
- End If
- i = i + 1
- 'increase counter
- 'display new text
- Let Text1.Text = temp
- End Sub
- Private Sub Command10_Click()
- 'Count "O" in String
- amnt = AmtInStr(Text6.Text, "o")
- Msg = "In The String: " & Text6.Text
- Msg = Msg & Chr(13) & Chr(10)
- Msg = Msg & "The Letter 'O' Appeared: " & amnt & " Times"
- sstyle = vbInformation
- ttitle = "Letter Counter"
- MsgBox Msg, sstyle, ttitle
- End Sub
- Private Sub Command11_Click()
- amnt = AmtInStr(Text6.Text, "e")
- Msg = "In The String: " & Text6.Text
- Msg = Msg & Chr(13) & Chr(10)
- Msg = Msg & "The Letter 'T' Appeared: " & amnt & " Times"
- sstyle = vbInformation
- ttitle = "Letter Counter"
- MsgBox Msg, sstyle, ttitle
- End Sub
- Private Sub Command2_Click()
- Dim i As Integer 'counting variable
- Dim temp As String 'text variable
- Let i = 1
- Let temp = Text1.Text
- Let Text1.Text = ""
- While i <= Len(temp)
- 'while the counter is less than the length of string
- If UCase(Mid(temp, i, 1)) = "A" Then
- 'if the character is blank then
- Mid(temp, i, 1) = "B"
- 'remove blank, add Null
- End If
- i = i + 1
- 'increase counter
- 'display new text
- Let Text1.Text = temp
- End Sub
- Private Sub Command3_Click()
- 'Make All Text Uppercase
- '------------------------
- Text2.Text = UCase(Text2.Text)
- End Sub
- Private Sub Command4_Click()
- 'Make All Text Lowercase
- '-----------------------
- Text2.Text = LCase(Text2.Text)
- End Sub
- Private Sub Command5_Click()
- 'Reverse Strings
- '---------------
- Dim temp(1 To 100)
- 'create array to store characters
- Dim temp2 As String
- Dim t As Integer
- Let t = 1
- Let temp2 = Text3.Text
- While t <= Len(Text3.Text)
- 'load array with each individual character
- temp(t) = Mid(Text3.Text, t, 1)
- t = t + 1
- Text3.Text = ""
- Let t = 0
- While t <= Len(temp2) - 1
- 'reverse array information & display
- Text3.Text = Text3.Text & temp((Len(temp2) - t))
- t = t + 1
- End Sub
- Private Sub Command6_Click()
- 'Trim Leading Spaces
- Let Text4.Text = LTrim(Text4.Text)
- End Sub
- Private Sub Command7_Click()
- 'Trim trailing spaces
- Let Text4.Text = RTrim(Text4.Text)
- End Sub
- Private Sub Command8_Click()
- 'decrypt Data
- Text5.Text = CryptString2(Text5.Text, False)
- 'this is done in a Public Function.
- 'CryptString2 = Function Name
- 'text5.text = Data to be Encrypted
- 'True = Not Encrypted Yet
- 'False = Encrypted, must be decrypted
- End Sub
- Public Function CryptString2(txtString As String, EnCrypt As Boolean) As String
- On Error GoTo errhandler
- Dim x As Integer
- Dim outString As String
- Dim iLen As Integer
- Dim sFirstSeed As String
- Dim sSecondSeed As String
- Dim iSeed As Integer
- If EnCrypt Then
- sFirstSeed = Left(txtString, 1)
- sSecondSeed = Mid(txtString, 2, 1)
- iSeed = (Asc(sFirstSeed) + Asc(sSecondSeed)) Mod 2
- iLen = Len(txtString)
- For x = 1 To iLen
- outString = Chr((Asc(Mid$(txtString, x, 1)) Xor iSeed) + 2) & outString
- Next
- outString = Chr(Asc(sFirstSeed) * 2 + 3) & outString
- outString = outString & Chr(Asc(sSecondSeed) * 2 - 3)
- Else
- sFirstSeed = Chr((Asc(Left(txtString, 1)) - 3) \ 2)
- sSecondSeed = Chr((Asc(Right(txtString, 1)) + 3) \ 2)
- iSeed = (Asc(sFirstSeed) + Asc(sSecondSeed)) Mod 2
- iLen = Len(txtString) - 1
- For x = 2 To iLen
- outString = Chr((Asc(Mid$(txtString, x, 1)) Xor iSeed) - 2) & outString
- Next
- End If
- CryptString2 = outString
- Exit Function
- errhandler:
- MsgBox "Error in CryptString" & vbCrLf & "Error: " & Err.Description & vbCrLf & "Number: " & Err.Number
- CryptString2 = ""
- End Function
- Private Sub Command9_Click()
- 'Encrypt Data
- Text5.Text = CryptString2(Text5.Text, True)
- 'this is done in a Public Function.
- 'CryptString2 = Function Name
- 'text5.text = Data to be Encrypted
- 'True = Not Encrypted Yet
- 'False = Encrypted, must be decrypted
- End Sub
- Public Function AmtInStr(String1 As String, String2 As String) As Long
- Dim Loop1 As Long, Amount As Integer
- Amount% = 0
- For Loop1& = 1 To Len(String1$)
- If InStr(Loop1&, String1$, String2$) <> 0 Then
- Loop1& = InStr(Loop1&, String1$, String2$)
- Amount% = Amount% + 1
- End If
- DoEvents
- Next Loop1&
- AmtInStr& = Amount%
- End Function
- Private Sub Form_Unload(Cancel As Integer)
- 'Show Credits and End
- Msg = "Thank You For Trying Teco's 'FUN WITH TEXT' Examples"
- Msg = Msg & Chr(13) & Chr(10) & Chr(13) & Chr(10)
- Msg = Msg & " Contact Teco: teco@tecotown.com" & Chr(13) & Chr(10)
- Msg = Msg & " Special Thanks To Jason Monroe and ANTI" & Chr(13) & Chr(10)
- sstyle = vbInformation
- ttitle = "Happy Coding!"
- MsgBox Msg, sstyle, ttitle
- End Sub
- Private Sub Label3_Click()
- End Sub
-