Click here to Skip to main content
15,920,111 members
Please Sign up or sign in to vote.
1.25/5 (3 votes)
See more:
hello,
i want to send data to a database on the press of the "Enter Key".
Thanks
Posted
Comments
ZurdoDev 12-Jul-12 8:12am    
Easy to do. Just write code to do it. If you need something more specific you'll have to share some of your code so we can see what you are doing.

You need to understand what does an 'Enter Key' do! It submits the form. You need to have a button on your form on click of which data of the form can be sent to database (code for saving data in the button Click handler). Now, as long as your button has focus, pressing enter will automatically submit the form calling the click event handler.

Try!
 
Share this answer
 
You can do that in several different ways, if you have a default button in your form then ENTER key will automatically press that button (as the default Windows behavior). Then you can control the event of clicking that button and insert there all the code needed to update the database *.

This solution will close the dialog (by default) if you don't modify that behavior.

If you don't have a default button, then you could be interested in capturing the key pressed WM_KEYDOWN or WM_KEYUP (probably better) and handling that event (message).


You can also handle the press of the enter key by KeyPress and KeyUp... search for them in google "keyup vb.net" and you'll get more information.


Hope this puts you at the beginning of the path... come back when you need further help... somebody will help you for sure.

* Notice that you've not specified which database are you using. Neither the way you want to connect your app with the database. Naither the kind of data and where it is stored...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900