Solved

Typing error monitor

Posted on 2002-04-23
8
161 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:dierdan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6964821
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
0
 
LVL 1

Accepted Solution

by:
hiranmaya earned 100 total points
ID: 6964853
Hi,

Try like following...


Dim strtocompare As String

Private Sub Form_Load()
strtocompare = "myword"
End Sub

Private Sub Text1_Change()
'check each character
If StrComp(Text1.Text, Mid(strtocompare, 1, Len(Text1.Text))) = 0 Then
    Debug.Print "right"
Else
    Debug.Print "wrong"
    'replace previous characters if any
    If Len(Text1.Text) = 1 Then
        Text1.Text = ""
    ElseIf Len(Text1.Text) > 1 Then
        Text1.Text = Mid(Text1.Text, 1, Len(Text1.Text) - 1)
    End If
End If
End Sub
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6966283
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:
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp
http://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
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:dierdan
ID: 6970609
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
0
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6970751
Dierdan

Thanks.

Congratulations hiranmaya.

But I have responded before hiranmaya's solution.

Narayanan.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6971511
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
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20294017

Moondancer - EE Moderator
0
 

Author Comment

by:dierdan
ID: 6972789
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
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6974960
Thank you, Dan.  I have already done this.
Moondancer - EE Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question