Press enter to mark answer

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Feb 2009
Posts: 12
Reputation: adamsn is an unknown quantity at this point 
Solved Threads: 0
adamsn adamsn is offline Offline
Newbie Poster

Press enter to mark answer

 
0
  #1
Oct 4th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 178
Reputation: Vineeth K is an unknown quantity at this point 
Solved Threads: 9
Vineeth K's Avatar
Vineeth K Vineeth K is offline Offline
Junior Poster

Re: Press enter to mark answer

 
0
  #2
Oct 4th, 2009
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 ....
Who wants to be a GOD ??
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 881
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 164
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: Press enter to mark answer

 
1
  #3
Oct 5th, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 12
Reputation: adamsn is an unknown quantity at this point 
Solved Threads: 0
adamsn adamsn is offline Offline
Newbie Poster

Press enter to mark answer

 
0
  #4
Oct 27th, 2009
Thank you very much. it works like magic.
Originally Posted by adamsn View 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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC