Link to home
Start Free TrialLog in
Avatar of dierdan
dierdan

asked on

Typing error monitor

G'day,
The basics:
I want to spell out a string (say "myword") with
for t = 1 to Len(myword)
 Letter = mid(myword,t,1)

I now want to compare this Letter with a character typed in a TextBox and if correct move on to character 2 and so on and type the whole word.
How can I do this please?
Thank you,   Dan
Avatar of n_narayanan
n_narayanan
Flag of India image

Try this,

I just developed for you, it is working for me. If it does not work for you, tell me i will mail you the project.

My email id is n_narayanan@yahoo.com

Option Explicit
Dim OrigMsg As String
Dim cnt As Integer
Private Sub Form_Load()
cnt = 1
OrigMsg = "myword"
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then 'backspace
    cnt = cnt - 1
    If cnt < 0 Then
        cnt = 1
    End If
    Exit Sub
End If

If Mid(OrigMsg, cnt, 1) = Chr(KeyAscii) Then
cnt = cnt + 1
    Exit Sub
Else
    KeyAscii = 0
    Exit Sub
End If

End Sub


Cheers

Narayanan
ASKER CERTIFIED SOLUTION
Avatar of hiranmaya
hiranmaya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Moondancer
Moondancer

hiranmaya ->  Please use comments as the other experts before you have done here.  The person asking the question can always convert the first best response comment to the accepted answer to grade and close it.  By Proposing an Answer as you have done here, it moved this question from the Open Question queue to the Locked Question queue, and few additional experts will step in to help; so a disservice to the Asker who seeks expeditious solutions and seeks more than one possibility.

More about that here:
https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp
https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

dierdan -->  If the proposed answer serves you, please accept it to grade and close this.  If it does not, please reject it and add comments.

Thank you,
Moondancer - EE Moderator
Avatar of dierdan

ASKER

Hi,
Both hiranmaya and narayanan have solved my question.
I am inclined to favour narayanan's answer but have no reason to reject hiranmaya's and therefore accept it.
I am posing a more general question related to this question.
Thank you both hiranmaya and narayanan for your input
Dan
Dierdan

Thanks.

Congratulations hiranmaya.

But I have responded before hiranmaya's solution.

Narayanan.
I have posted a question for you, Narayanan, without charging the Dierdan for it in the question below for your help here.  Dierdan, please let us know if/when such situations occur so we can process point splits for you, by posting a zero point question in Community Support, include the link.

Thanks,

 Points for n_narayanan ->  Please comment here
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20294017

Moondancer - EE Moderator
Avatar of dierdan

ASKER

You are right moondancer, under the circumstances I should have split the points.
I wish to make amends by granting Naraynan 100 points also.
Thanks Narayanan.
Cheers,      Dan
Thank you, Dan.  I have already done this.
Moondancer - EE Moderator