944,048 Members | Top Members by Rank

Ad:
Oct 4th, 2009
0

Press enter to mark answer

Expand Post »
hi all

i am using VB6 and is writing a code for a maths project. learners have to enter an answer into a textbox and press enter to mark the given answer. i am currently using a command button to mark the answer, but it is time consuming. the idea is to do as many sums as possible in a limited time span.

thank you

Ta'Nick
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
adamsn is offline Offline
12 posts
since Feb 2009
Oct 4th, 2009
0

Re: Press enter to mark answer

I think you want to add events in key press.In this case the simple and easy way is to add this code :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Text1_KeyPress(KeyAscii As Integer)
  2. If KeyAscii = vbKeyReturn Then
  3. Label1.Caption = Text1.Text
  4. End If
  5. End Sub
Here you can call an even in key press and compare the Key pressed with the key you want ....

And if you want to clean the text after that just add this line
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Text1.Text = ""
Try it....
Best of luck ....
Reputation Points: 20
Solved Threads: 18
Posting Whiz in Training
Vineeth K is offline Offline
206 posts
since Sep 2009
Oct 5th, 2009
1

Re: Press enter to mark answer

Without having to change any of your code you can still accomplish what you want. In the forms design view, highlight the button and then goto its properties. Find the "default" property and make it true.

This property tells the OS that this button is the default button to press when user hits enter key.



Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Oct 27th, 2009
0

Press enter to mark answer

Thank you very much. it works like magic.
Click to Expand / Collapse  Quote originally posted by adamsn ...
hi all

i am using VB6 and is writing a code for a maths project. learners have to enter an answer into a textbox and press enter to mark the given answer. i am currently using a command button to mark the answer, but it is time consuming. the idea is to do as many sums as possible in a limited time span.

thank you

Ta'Nick
Reputation Points: 10
Solved Threads: 0
Newbie Poster
adamsn is offline Offline
12 posts
since Feb 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how to solve this
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Error "Provider not found"





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC