by Stephen Blaising (3 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 12th January 2000
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
This is an evolution of Lee Turners code. This will allow you to call this form and pass in any string to print out one character at a time
'Pass in the text you wish to display.
'For example ... Call Form1.DisplayText("Hello World")
Private PrintString As String
Private mintCharCounter As Integer
Public Sub DisplayText(ByVal sDisplay As String)
PrintString = sDisplay
Me.Show vbModal
End Sub
Private Function IsGoodChar(tString As String) As Boolean
On Error GoTo IError
Dim i As Byte
If Len(tString) = 1 Then
i = Asc(tString)
If i >= 33 And i <= 255 Then
IsGoodChar = True
Else
IsGoodChar = False
End If
Else
IsGoodChar = False
End If
Exit Function
IError:
IsGoodChar = True
End Function
Private Sub Form_Load()
mintCharCounter = 0
Timer1.Interval = 100
Label1.Caption = ""
Timer1.Enabled = True
'PrintString = "Written And Developed By Lee Turner" & vbCrLf & "Copyright (c) 2000" & vbCrLf & "All Rights Reserved" & vbCrLf & "If you have any questions, please direct them to: /dev/null" & vbCrLf & vbCrLf & vbCrLf & "j/k ;o) Direct them to: [email protected]" & vbCrLf & "Source code for this project is available at: http://www.lturner.co.uk"
End Sub
Private Sub Timer1_Timer()
Dim letter As String
If mintCharCounter = 0 Then mintCharCounter = 1
Do
letter = Mid$(PrintString, mintCharCounter, 1)
mintCharCounter = mintCharCounter + 1 'move along the string one bit at a time
Label1.Caption = Label1.Caption & letter ' so to not pause while printing no viewable characters
'Keep looping until a viewable character is found or we've come to the end of the string
Loop While Not (IsGoodChar(letter) Or mintCharCounter = Len(PrintString))
If mintCharCounter = Len(PrintString) Then Timer1.Enabled = False 'stop timer
End Sub
No comments have been posted about This is an evolution of Lee Turners code. This will allow you to call this form and pass in any str. Why not be the first to post a comment about This is an evolution of Lee Turners code. This will allow you to call this form and pass in any str.