Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2004, 10:29 AM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Enter Key

Is it possible to use the enter key to submit data in VB? If so, how? I can't seem to figure it out.

Thanks

Renee C. Walker
__________________
Renee C. Walker
 
Old April 7th, 2004, 10:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there.. i think you have to be more explicit.. what do you want to submit with the enter key??
you can trap the key when is pressed..

HTH

Gonzalo
 
Old April 7th, 2004, 10:37 AM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I want to save data to a database by pressing the enter key. I tried using the command button, but that doesn't work.

Renee C. Walker
 
Old April 7th, 2004, 10:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

so.. you press the enter key and you do the stuff to save to the database..
where you have problems?? getting when the enter key is pressed??
saving the data to the database???
also, if you press the enter key when a command button has the focus, it's like clicking it...


HTH

Gonzalo
 
Old April 7th, 2004, 10:42 AM
Authorized User
 
Join Date: Jun 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello
Try this
Private Sub txtInsp_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        'Do your stuff here
    End If
End Sub
 
Old April 7th, 2004, 11:04 AM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That Worked!!

Thanks

Renee C. Walker





Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter Key Event (Enter Key Only) Coby Excel VBA 0 February 6th, 2008 09:55 PM
use enter key to exit mastrgamr C++ Programming 1 January 18th, 2007 10:50 AM
how to disable enter key for a particular button g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 1 January 19th, 2006 11:22 AM
How would you determine the "ENTER' key? mcinar HTML Code Clinic 15 March 24th, 2005 10:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.