VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code changes the ASCII number of a key pressed so that when you type something in a text box,

by Jeff Calder (3 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 19th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code changes the ASCII number of a key pressed so that when you type something in a text box, the letters that appear spell something

API Declarations


no declarations

Rate This code changes the ASCII number of a key pressed so that when you type something in a text box,



Option Base 1

Private Sub Form_KeyPress(KeyAscii As Integer)
    
    Const strWord As String = "Place Text Here"
    Static intIndex As Integer
    Static intWord() As Integer
    
    ReDim Preserve intWord(Len(strWord))
    If intWord(1) = 0 Then
        For intIndex = 1 To Len(strWord)
            intWord(intIndex) = Asc(Mid(strWord, intIndex, 1))
        Next intIndex
        intIndex = 1
    End If
    If intIndex = 0 Then intIndex = 1
    If intIndex = (UBound(intWord()) + 1) Then intIndex = 1
    KeyAscii = intWord(intIndex)
    intIndex = intIndex + 1
    
End Sub

Private Sub Form_Load()

    Randomize

End Sub

Download this snippet    Add to My Saved Code

This code changes the ASCII number of a key pressed so that when you type something in a text box, Comments

No comments have been posted about This code changes the ASCII number of a key pressed so that when you type something in a text box, . Why not be the first to post a comment about This code changes the ASCII number of a key pressed so that when you type something in a text box, .

Post your comment

Subject:
Message:
0/1000 characters