|
-
Sep 17th, 2000, 04:07 PM
#15
Thread Starter
Junior Member
Well, as my General Declarations, I have:
Dim tString As String, tText
Dim LettToWord() As String
Dim LastChar As String
Dim inCounter As Integer
Dim I As Integer
when i run it, i get a
"Run time error '9'
subscript out of range"
and when u click debug, it highlights theline below in yellow:
two.text = two.text & LettToWord(KeyAscii)
So you can see what I have so far, I posted it below
(text1=one, text2=two, and my gen. decs. are above, ):
Option Explicit
Const numWords = 2
Dim myWords(numWords) As String
Dim myChars(numWords) As String
Private Sub frmMain_Load()
'//This is a very boring part of the code in which
'//I tell the program what it should replace a given letter with
For I = 65 To 90 '//A to Z
ReDim Preserve LettToWord(I)
Select Case I
Case 65
LettToWord(I) = "STRINGFORA"
Case 66
LettToWord(I) = "STRINGFORB"
Case 67
LettToWord(I) = "STRINGFORC"
Case 68
LettToWord(I) = "STRINGFORD"
Case 69
LettToWord(I) = "STRINGFORE"
End Select
'//and just go on and on until "Z"
Next I
For I = 97 To 122 '//a to z
ReDim Preserve LettToWord(I)
Select Case I
Case 97
LettToWord(I) = "STRINGFORa"
Case 98
LettToWord(I) = "STRINGFORb"
Case 99
LettToWord(I) = "STRINGFORc"
Case 100
LettToWord(I) = "STRINGFORd"
Case 101
LettToWord(I) = "STRINGFORe"
'//and you would have to just go on and on until you've reached "z"
End Select
Next I
End Sub
Private Sub one_KeyPress(KeyAscii As Integer)
LastChar = Right(one.text, 1)
If KeyAscii = vbKeyBack Then
two.text = Left(two.text, Len(two.text) - Len(LettToWord(Asc(LastChar))))
Else
two.text = two.text & LettToWord(KeyAscii)
End If
End Sub
also, How would I add in the delete key?
Thanks,
-System
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|